Java CommentsThe Java comments are the statements that are not executed by the compiler and interpreter. The comments can be used to provide information or explanation about the variable, method, class or any statement. It can also be used to hide program code. Types of Java CommentsThere are three types of comments in Kava.
1) Java Single Line CommentThe single line comment is used to comment only one line. Syntax: Example: Output: 10 2) Java Multi Line CommentThe multi line comment is used to comment multiple lines of code. Syntax: Example: Output: 10 3) Java Documentation CommentThe documentation comment is used to create documentation API. To create documentation API, you need to use javadoc tool. Syntax: Example: Compile it by javac tool: javac Calculator.java Create Documentation API by javadoc tool: javadoc Calculator.java Now, there will be HTML files created for your Calculator class in the current directory. Open the HTML files and see the explanation of Calculator class provided through documentation comment. Next TopicJava Programs
|