Comments in Java

0
58
Java Comments

In this tutorial, you’ll learn how to add Java Comments which is the basic and start of your Java Programming.

The Java Comments are used to comment is a programmer-readable explanation or annotation in the source code of a computer program

The characters in the /* */ are comments:

/*
* The HelloWorldApp class implements an application that
* simply displays "Hello World!" to the standard output.
*/
class HelloWorldApp
{
public static void main(String[] args)
{
System.out.println("Hello World!"); //Display the string.
}
}

The Java language supports three kinds of comments:

/* text */

The compiler ignores everything from /* to */.

/** documentation **/

This indicates a documentation comment (doc comment, for short). The compiler ignores this kind of comment, just like it ignores comments that use /* and */. The JDK Javadoc tool uses doc comments when preparing automatically generated documentation.

// text

The compiler ignores everything from // to the end of the line.

Ask your questions and clarify your/others doubts on Java Comments by commenting. Java Documentation.

PREVIOUS
JAVA HELLO WORLD!
NEXT
JAVA KEYWORD