JavaDoc and code comments

There is also another difference between what we presented here earlier and the listing. This is the commenting of the code. Code comments are part of the program, which is ignored, and filtered out by the compiler. These comments are solely for those who maintain or use the code.

In Java, there are two different comments. The code enclosed between /* and */ are comments. The start and the end of the comment do not need to be on the same line. The other type of comment start with the // characters and end at the end of the line.

To document the code, the JavaDoc tool can be used. JavaDoc is part of the JDK and it is a special tool that reads the source code and extracts HTML documentation about the classes, methods, ...

Get Java Projects - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.