There are three types of comments in Java.
1. single line comment
2. multi line comment
3. java documentation
Single Line Comments:
These comments are for making a single line as a comment. These comments start with double slash symbol // and after this, whatever we written till end of the line is taken as a comment.
Example:
//This is my comment of one line.
Multi Line Comments:
These comments are used for representing several lines as comments. These comments start with /* and end with */. In between /* and */, whatever is written is treated as a comment.
Example:
/* This is a multi line comment. This is line one. This is line two of the comment This is line three of the comment. */
Java Documentation Comments:
These comments start with /** and end with */. These comments are used to provide description for every feature in a Java program. This description proves helpful in the creation of a .html file called API(Application Programming Interface) document. Java Documentation comments should be used before every feature in the program as shown here:
/** description about the class */ Class code{ /** description about a method */ Method code(){ } }