Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Java Beginners Comments in Java Code


Share on Google+Share on Google+

Comments in Java Code

In any programming language comments are necessary to understand the code by peer programmers. It is also becomes vital when you write a complex and large applications.

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

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: December 22, 2013

Related Tutorials

Discuss: Comments in Java Code  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image