Comments are included in a program for better understanding about the program. There are three types of comments in java. They are
1 . Single line comment
2 . Multi line comment
3 . Documentation comment
Single line comment
Single line comment should end on a single line and should begin with double slash (//).
Example: //Java is flexible
Multi line comments
If the comment exceeds one line, multiline comment is used. these comments must begin with /* and end with */.
Example: /*This program is used to calculate
the salary of the employees*/
Documentation comments
This comment is used to generate documentation automatically. these comments must begin with /** and ends with */. Java scans the program finds /** and */ and generate documentation automatically with the help of the documentation utility javadoc .
1 . Single line comment
2 . Multi line comment
3 . Documentation comment
Single line comment
Single line comment should end on a single line and should begin with double slash (//).
Example: //Java is flexible
Multi line comments
If the comment exceeds one line, multiline comment is used. these comments must begin with /* and end with */.
Example: /*This program is used to calculate
the salary of the employees*/
Documentation comments
This comment is used to generate documentation automatically. these comments must begin with /** and ends with */. Java scans the program finds /** and */ and generate documentation automatically with the help of the documentation utility javadoc .
No comments:
Post a Comment