+84 1649 660 740

Saturday, 16 August 2014

Comments in Java

Comments in Java, as in most programming language, do not show up in the executable program. Thus, you can add as many comments as needed without fear of bloating the code. Java has three ways of marking comments. The most common form is a //. You use this for a comment that will run from the // to the end of the line.

   System.out.println("We will not use 'Hello, World!'"); // is this too cute?
When longer comments are needed, you can mark each line with a //, or you can use /* and */ comment delimiters that let you block off a longer comment.

Finally, a third kind of comment can be used to generate documentation automatically. This comment uses a /** to start and a */ to end.
/**
* This is the first sample program in Core Java
* @version 1.01 1997-03-22
* @author webmobileaz
*/
public class FirstSample
{
  public static void main(String[] args)
  {
    System.out.println("We will not use 'Hello, World!'");
  }
}
View Project 

 Download Project

0 comments:

Post a Comment