The JavaTM Tutorial

| Start of Tutorial > Start of Trail > Start of Lesson | Search Feedback Form

Trail: Getting Started
Lesson: A Closer Look at HelloWorld

## Comments in Java Code

> The bold characters in the following listing 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. For more information on `javadoc`, see the Java tool documentation .
> `// text`
>   The compiler ignores everything from `//` to the end of the line.

| Start of Tutorial > Start of Trail > Start of Lesson | Search Feedback Form

Copyright 1995-2001 Sun Microsystems, Inc. All rights reserved.