Comments

Comments can appear anywhere in a source file. Comments are identical to those in C and C++. Everything between /* and */ is ignored by the compiler and everything on a line after two consecutive slashes is also thrown away. Therefore the following program is, as far as the compiler is concerned, identical to the first one:

// This is the Hello World program in Java
class HelloWorld {

    public static void main (String args[]) {
      /* Now let's print the line Hello World */
      System.out.println("Hello World");

  }

}

Comments are closed.