Adding a Javadoc Comment to Source Code

You can type a Javadoc comment directly in the Source Editor. If you need help with the content or format of a Javadoc comment, use the Javadoc Comment dialog box to create your comment.

To add a comment using the Source Editor:

  1. Place the insertion point in the line immediately before the class, interface, constructor, method, or field declaration you want to document.
  2. Type your comment using the correct Javadoc format.
  3. Save your changes in the Source Editor.

To add a comment using the Auto Comment dialog box:

  1. In the Filesystems tab of the Explorer, right-click the source file for which you want to create documentation and choose Tools Auto Comment.

    The Auto Comment Tool dialog box opens and displays the classes, interfaces, and other entities in the source code and their Javadoc status ( indicates a valid Javadoc comment, indicates a partial or erroneous comment, and indicates no comment).

  2. In the Auto Comment Tool dialog box, select the entity for which you want to create or edit a comment.
  3. Use the following panels to modify the comment.
    Details Provides information on whether the comment is valid or what's missing from an invalid Javadoc comment.
    Javadoc Comment Text Provides a text field in which you can modify the comment description. At the bottom of the dialog box is a row of command buttons you can use to include HTML elements (<B>, <I>, <U>, <CODE>, <PRE>) for formatting your text and the Javadoc tag {@link}.
    Tags Provides a list of existing tags in the comment, which you can select and edit. To create a new tag, click New.
  4. Close the dialog box.

    The changes are saved in the source file.

For more information about Javadoc tags, visit the Sun Microsystems web page at
http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/javadoc.html. For information on how to write Javadoc comments, see
http://java.sun.com/products/jdk/javadoc/writingdoccomments/index.html.

See also
Format of a Javadoc Comment
Generating Javadoc Documentation

Legal Notices