public class AsposeTest {

	public static void main(String[] args) throws Exception {//Main function to delete all comments from a Word document

	    // Instantiate a license
	    com.aspose.slides.License slidesLicense = new com.aspose.slides.License(); 
	    slidesLicense.setLicense("Aspose.Total.lic");

	    // Load the input Word document
	    com.aspose.words.Document doc = new com.aspose.words.Document("FileWithComments.docx");

	    // Get all comments in the document
	    com.aspose.words.NodeCollection comments = doc.getChildNodes(com.aspose.words.NodeType.COMMENT, true);

	    // Remove all comments
	    comments.clear();

	    // Save output file
	    doc.save("WithoutComment.docx");

	    System.out.println("Done");
	}
}