Jump to content

Javadoc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by RedWolf (talk | contribs) at 22:00, 26 December 2004 (tool for generating HTML documentation from Java source code). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Javadoc is a computer software tool from Sun Microsystems for generating API documentation into HTML format from Java source code.

Javadoc is the industry standard for documentating Java classes. Most IDEs will automatically generate Javadoc HTML.

Developers use certain commenting styles and Javadoc tags when documenting source code. A Java block comment starting with "/**" will begin a Javadoc comment block which will be included in the generated HTML. A Javadoc tag begins with an "@" (at sign). Some tags are provided in the following table.

tag description
@author Developer name
@deprecated Marks a method as deprecated.
@exception Documents an exception thrown by a method — also see @throws.
@throws Documents an exception thrown by a method. A synonym for @exception introduced in Javadoc 1.2.
@param Defines a method parameter. Required for each parameter.
@returns Documents the return value. This tag should not be used for constructors for methods defined with a void return type.
@see Documents an association to another method or class.
@since Documents when a method was added to a class.
@version Provides the version number of a class or method.

An example for a method follows.

/**
 * Validates a chess move.
 * @author John Doe
 * @param theFromFile File of piece being moved
 * @param theFromRank Rank of piece being moved
 * @param theToFile   File of destination square
 * @param theToRank   Rank of destination square
 * @returns true if a valid chess move or false if invalid
 */
 boolean isValidMove(int theFromFile, int theFromRank, int theToFile, int theToRank)
 {
     ...
 }