Friday, 11 December 2015

Comments in Java

Java Tutorial
First steps to Java Programming
Comments in Java:
First of all we need to understand what is the use of comments in java. Suppose you are joining a company as a developer and you got an existing project, now if you are going through the code, It will take hell lot of time to understand the coding done by someone else.  But if that person has followed the stander procedure then he defiantly has kept some comments so that anyone can understand the code in better way.
There are 3 ways to keep comments in Java:

1.    Single Line comment

// single line comment
Here we can keep comments in single line


2.     Multi Line comment

/* Multiple line comment. Here we can keep n no of lines of comment.
This is 2nd line.
This is 3rd line */


3.     Java documentation comment

/** Java documentation comment */
These comments are used to provide the description of every feature in a java programming.
This description use to create a .html file called API (Application programming Interface) document.

               

 Command to generate the .html file is:

 javadoc className.java

No comments:

Post a Comment