Java comments.

Java Programming Java8Object Oriented Programming

Java supports single-line and multi-line comments very similar to C and C++. All characters available inside any comment are ignored by Java compiler.

Example

Live Demo

public class MyFirstJavaProgram {

   /* This is my first java program.
      * This will print 'Hello World' as the output
      * This is an example of multi-line comments.
   */

   public static void main(String []args) {
      // This is an example of single line comment
      /* This is also an example of single line comment. */
      System.out.println("Hello World");
   }
}

Output

Hello World
raja
Published on 22-Apr-2018 21:45:03
Advertisements