| CIT 594 Basic Javadoc and HTML Spring 2004, David Matuszek |
Javadoc
Javadoc comments have the following form:
/** * Describes of the immediately following class, interface, * constructor, method, or field. The first sentence is special; * it is used as a summary statement. * * @tag Text for this tag. Tags should go at the end. */
Style rules for Javadoc
@param tags to describe each parameter.@return tag to describe the result (unless its
void).@throws tags to describe any thrown Exceptions."Finds the first blank in the string."@author and @version tags for your classes
and interfaces.See "The Elements of Java Style" by Allan Vermeulen et al. for more details.
HTML
Javadoc comments are written in HTML. HTML is ordinary text with special tags to indicate typographical effects. Here are some of the basic HTML tags you should know.
| Tag | Meaning | Example | Result |
|---|---|---|---|
<i>...</i> |
Italics | This <i>does</i> matter! |
This does matter! |
<b>...</b> |
Boldface | This <b>does</b> matter! |
This does matter! |
<br> |
Line break | Roses are red<br>Violets are blue |
Roses are red Violets are blue |
<p> |
Paragraph | Roses are red<p>Violets are blue |
Roses are red Violets are blue |
<pre>...<pre> |
Preformatted (monospaced, all whitespace preserved) |
<pre>NW N NE |
NW N NE
\ | /
W---+---E
/ | \
SW S SE
|
<code>...<code> |
Code (or names defined in code) | Returns one <code>Token</code> to the tokenizer object... | Returns one Token to the tokenizer
object... |
Because the characters '<', '>', and '&'
have special meanings in HTML, if you want to put these actual characters in
your Javadoc, you have to encode them as follows:
|
|