Class 1, Part 2 |
Intro to Java 30-IT-396 |
|
Comments
-
Always, always, always comment your code. Trust me on this one.
-
Java includes a tool, javadoc, that looks through comments in your source
code and produces documentation.
-
For javadoc comments, start with /** and end with */. You may use
multiple lines.
-
You may also use tags, which start with @. These have special meanings
to javadoc, and there are a predefined list of tags. When you enter
@ in a comment field, Forte' will pop up the related tag names for you.
-
The first sentence of your comment should be a summary statement.
-
You can use some HTML tags in your comments. These will be sent through
the Javadoc and displayed as HTML when viewed.
-
Class comments go between the import statments and the class definition.
-
Method comments preceed the appropriate methods, and have the following
tags.
-
@param one for each parameter.
-
@return to specify the return type
-
@throws states the exceptions thrown.
-
Field comments
-
Only document public fields. Generally, these should be static final
fields.
-
More tags
-
@author followed by the author's name.
-
@version text describing the version
-
@since a since entry
-
@deprecated when this was deprecated, or marked for eventual removal.
-
@see link refer to the link instead. If you just put a package
and class, Javadoc will insert the URL of the javadoc for that package
and class.
-
To create a link anywhere in your comments, use the syntax {@link package.class#feature
label}
More About Javadoc


Created by: Brandan
Jones January 4, 2002