Using the Javadoc Comment dialog box, you can add or edit a documentation comment in your source code. Open the Javadoc Comment dialog box for a specific class by clicking the ellipsis button (...) in the Javadoc Comment property in the property sheet. A Javadoc comment consists of two parts: text and tags.
The first sentence of the comment should be a
summary description of the
declared entity. The text may include HTML elements, such as <B>
and <I>
, for formatting the description. Heading elements, such as <H1>
and <H2>
, are reserved for use by the Javadoc tool. You can use the command buttons at the bottom of the Javadoc Comment dialog box
to include the HTML elements <B>
, <I>
,
<U>
, <CODE>
, and <PRE>
and the Javadoc
{@link}
in the description. For example:
/** * Returns the Class of this <I>Object</I>. * Java has a runtime representation for * classes--a descriptor of type Class-- * which the method getClass() returns for * any Object. */
You do not need to type the characters /**
and */
or the leading asterisks. These characters are automatically
included when you click OK and the IDE adds the comment to the source
code.
A Javadoc tag starts with the character @
followed by a special keyword. Tags are case sensitive.
A Javadoc tag enables you to automatically generate information for the API documentation. For example,
@author
name adds an author entry with the specified
name to the generated documentation. A tag must appear
at the beginning of a line. Otherwise, the tag is treated as normal text. By convention, tags with the same name are grouped together. The following comment
includes four Javadoc tags:
/** * A class representing a screen window. * For example: * Window win = new Window(parent); * win.show(); * * @author Lynne Haley * @version 1.3 00/08/08 * @see java.awt.BaseWindow * @see java.awt.Button */
<B>
and <I>
)
and the inline Javadoc tag
{@link}
.
For more information on how to write Javadoc comments, see the Sun Microsystems
web page at http://java.sun.com/products/jdk/javadoc/writingdoccomments/index.html
.
For detailed information about Javadoc tags, see
http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/javadoc.html
.
See also | |
---|---|
Adding a Javadoc Comment to Source Code |