/** and /* in 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.

/** is known as documentation comments. It is used by Javadoc tool while creating the documentation for the program code.

/* is used for multi-line comments.

Example

Live Demo

/**
   * This is a documentation comment.
   * This is my first Java program.
   * This will print 'Hello World' as the output
   * This is an example of multi-line comments.
*/
public class MyFirstJavaProgram {
   public static void main(String[] args) {
      /* This is an example of multi line comment. */
      System.out.println("Hello World");
   }
}


raja
Published on 22-Apr-2018 21:41:28
Advertisements