COMMENTS IN JAVA
In JAVA there are three types of comments
SINGLE LINE COMMENTS
These comments are for marking a single line as a comment. These comments are start with a double slash symbol (//)
E.g. //THIS IS MY FIRST CLASS.
DOUBLE LINE COMMENTS
These comments are used for representing several lines as a comment .these comments start with /* and end with */.
E.g. /* THIS IS MY FIRST ROW.
THIS IS SECOND ROW.
THIS IS THIRD ROW. /*
JAVA DOCUMENTATION COMMENTS
These comments are used to provide description for every feature in a Java Program . these are start with /** and end with */.
By the use of this .html file is created which is also called as API(Application Programming Interface) document.
E.g. /** DESCRIPTION ABOUT CLASS*/
CLASS CODE
/**DESCRIPTION ABOUT METHOD*/
METHOD CODE
- Like c,c++ we use comments to know the process of program or operation performed in program , In JAVA we also use comments to describe the performed operation.
- Comments are description about the features of program.
- When we write comment in our program , we can understand what is program doing as well as it help others to easily to follow our code.
The biggest advantage of the comments is that readability & understanding of the program increases.
TYPES OF COMMENTS
- Single Line
- Multi Line
- Java Documentation
SINGLE LINE COMMENTS
These comments are for marking a single line as a comment. These comments are start with a double slash symbol (//)
E.g. //THIS IS MY FIRST CLASS.
DOUBLE LINE COMMENTS
These comments are used for representing several lines as a comment .these comments start with /* and end with */.
E.g. /* THIS IS MY FIRST ROW.
THIS IS SECOND ROW.
THIS IS THIRD ROW. /*
JAVA DOCUMENTATION COMMENTS
These comments are used to provide description for every feature in a Java Program . these are start with /** and end with */.
By the use of this .html file is created which is also called as API(Application Programming Interface) document.
E.g. /** DESCRIPTION ABOUT CLASS*/
CLASS CODE
/**DESCRIPTION ABOUT METHOD*/
METHOD CODE
0 comments:
Post a Comment