Java Reference
In-Depth Information
* Xyz class declaration. Note that a documentation comment for a package
* declaration is written differently and it is not written in the
* source code.
*/
package com.jdojo.utility;
public class Xyz {
/* Code for Xyz class goes here */
}
/* Example #2 */
package com.jdojo.utility;
/**
* This documentation comment is intended for the class declaration
* Xyz. It will be used by the javadoc tool, because it appears just
* before the Xyz class declaration.
*/
public class Xyz {
/* Code for Xyz class goes here */
}
Writing Documentation Comments
You can write three types of comments in Java source code:
Single-line comments
Multi-line comments
Documentation comments
The first two types of comments are free-form comments and they are meant for the developers to read. The third
type of the comment is meant to be processed by the javadoc tool to generate HTML documents for the source code.
The textual part of the documentation comment may include HTML tags, and those tags will be interpreted
as HTML in the generated HTML document. For example, to display the text “Hello” in boldface font as part of the
documentation comment, you can write <b>Hello<b> as shown:
/**
* You can include HTML tags in documentation comments. This will
* display <b>Hello</b> in boldface font.
*/
Apart from HTML tags, you can also use some special tags. A tag in a documentation comment is a special type
of keywords that is interpreted and processed by the javadoc tool. Two types of tags can be used:
Block tags
In-line tags
A block tag is of the following form:
@tagName tagText
 
Search WWH ::




Custom Search