Comments in Java


☞There are three types of comments in Java.

1. Single-line comment
2. Multi-line comment
3. Documentation comment

Single-line comment :

☞Begin with // and terminate at the end of the line.

Example :
//Program to find even or odd


Block or multiple-line comment :

☞Begin with /* and terminate with */ that spans multiple lines.

Example :
/* Program to find average of three numbers.
Inputs are 5, 7, 3 */


Documentation comment :

☞Begin with /** and terminate with */ that spans multiple lines.

☞This comment is not a discussion about the program logic but includes some text document to be viewed by other users.

Example :
/** Author Name : Avlokan Mohan
Qualification : Master of Computer Applications
Job : Self-Employed */