Java Reference
In-Depth Information
Here,
info
is a string that contains version information, typically a version number, such as
2.2. You will need to specify the
-version
option when executing
javadoc
in order for the
@version
field to be included in the HTML documentation.
The General Form of a Documentation Comment
After the beginning
/**
, the first line or lines become the main description of your class,
interface, field, constructor, or method. After that, you can include one or more of the vari-
ous
@
tags. Each
@
tag must start at the beginning of a new line or follow one or more
asterisks (
*
) that are at the start of a line. Multiple tags of the same type should be grouped
together. For example, if you have three
@see
tags, put them one after the other. In-line
tags (those that begin with a brace) can be used within any description.
Here is an example of a documentation comment for a class:
What javadoc Outputs
The
javadoc
program takes as input your Java program's source file and outputs several
HTML files that contain the program's documentation. Information about each class will
be in its own HTML file.
javadoc
will also output an index and a hierarchy tree. Other
HTML files can be generated.
An Example That Uses Documentation Comments
Following is a sample program that uses documentation comments. Notice the way each
comment immediately precedes the item that it describes. After being processed by
javadoc
, the documentation about the
SquareNum
class will be found in
SquareNum.html
.