Christopher Koho Christopher Koho - 4 months ago 8
Java Question

Diffrent style in code commenting

What is the difference in commenting (in Eclipse at least) your code like this:

/**
* This is a comment
*/


and this:

/*
* This is a comment
*/


It appears in another colour.

Answer

The first syntax:

/**
 * This is a comment  
 */

Is a JavaDoc comment, used for documentation, which is parsed automatically by IDEs and documentation tools.

/*
 * This is a comment  
 */

Is just a normal block-comment, used when you want to write a multi-line comment.

// This is a comment

Is just a normal, single-line comment.

See the JavaDoc Documentation here.

Comments