Java ignores all comments. There is, however, a program called javadoc which reads certain kinds of comments and produces HTML documentation (see below).
// characters,
Java ignores everything to the end of the line. This is the most
common type of comment.
//--- local variables ---
int nquest; // number of questions.
int score; // count of number correct minus number wrong.
/* characters,
Java will ignore everything until it
finds a */.
This kind of comment can cross many lines, and is commonly used
to "comment out"
sections of code -- making Java code into a comment while debugging
a program. For example,
/* Use comments to describe variables or sections of the program.
They are very helpful to everyone who reads your programs:
your teacher, your boss, but especially yourself!
*/
/**
are used
by the javadoc program to produce HTML documentation for the program.
The Java documentation from Sun Microsystems is produced using javadoc.
It is essential to use this kind of comment for large programs.