Comments in Java code required to write description about a method, function and class used in the program. In any programming language comments are usually written by developers to understand the code by peer programs. Comments in Java code are simply ignored by the compiler at run time. So, you can write any number of comments lines you want in your Java code.
In Java programming language comments can be written in three different styles.
/* comment */
Anything written with in this comment block /* comment */ will be ignored by compiler.
/** documentation comment*/
This type of comment is known as document comment that can be further used by programmers in their code. These types of codes are normally auto generated into the programs. It depends on you if you want to use these codes into your program or not.
// single line comment
This type of comments is used to write a single line comments in Java. The Java compiler ignores everything written from // to the end of the line.
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: Comments in Java Code
Post your Comment