How to Write Comments in Java Code with javadoc
javadoc command line utility is a convenient way to document your Java code. To learn how to write comments for use by
javadoc, follow these four steps.
- Open your text editor and create a new file that will contain the demonstration program. Type in the following Java statements.
javadoccomments start with
/**and end with
**/. Various annotations are supported such as
- Save your file as WriteCommentsWithjavadoc.java.
- Open a command prompt and navigate to the folder containing your Java program. Then type in the
javadocstatement followed by the Java source file name and hit Enter.
javadoccommand will create several HTML files, including
WriteCommentsWithjavadoc.html. These files will be placed in the current directory.
WriteCommentsWithjavadoc.htmlin your browser. Now you see the results of writing comments in your Java code with