Free Java Guide

These tutorials will introduce you to Java programming language. You'll compile and run your own Java application, using Sun's JDK. It's quite easy to learn java programming skills, and in these parts, you'll learn how to write, compile, and run Java applications. Before you can develop corejava applications, you'll need to download the Java Development Kit (JDK).


Java Comments

The Java programming 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. 


Java denotes comments in three ways:

1. Double slashes in front of a single line comment:

int i=5; // Set the integer to 5

2. Matching slash-asterisk (/*) and asterisk-slash (*/) to bracket multi-line comments:

Set the integer to 5
int i=5;

3. Matching slash-double asterisk (/**) & asterisk-slash(*/) for Javadoc automatic hypertext documentation, as in

This applet tests graphics.
public class testApplet extends applet{...


* Asterisks inside the comment are ignored by javadoc so they
* can be used to make nice line markers.

The SDK tool javadoc uses the latter /** ..*/ comment style when it produces hypertext pages to describe a class.

Next: Java Data and Variables