Java – How to document your code ?

Problem Statement

You need to document your java classes so that it helps in maintenance.

Solution

Use Javadoc and place comments before any method , field or class to document.

Just enter /** to start writing the comments using javadoc. The subsequent lines needs to begin with * and end the comment section with */

Below is a sample code demonstrating the usage of the javadoc for the comments.

Java

The specific format defined above lets the developers to generate HTML documentation for the classes using the command-line tool called Javadoc. This tool parses the java source file and generates HTML documentation.

Eg :

javadoc abundantcodeconsole.java

You can also pass the complete package to the Javadoc tool instead of the single java file.

javadoc abundantcode

Tags :

Leave Your Comment