Title: Javadoc
1Javadoc
- CSC 172
- SPRING 2002
- EXTRA LECTURE
2TWO AMAZING FACTS
- The average college student spends 375/yr on
textbooks. - The average college student spends 1750/yr on
pizza and beer.
3JAVADOC
- A documentation comment
- can be extracted and used by the javadoc utility
- to generate HTML documentation for a program
- begins with /
- ends with /
4Documentation comments
- A single documentation comment can be placed
immediately preceding - Class and interface definitions
- Member method definitions
- Member variable definitions
- If placed elsewhere, it is treated as a regular
comment
5Example
- /
- This class implements a ltigtgeneric stacklt/igt.
An array is - used to implement the stack.
- _at_author K.A.M.
- _at_version 1.1
- /
- public class Stack /class def/
6Inside the comment
- Leading white space asterisks are ignored
- The first sentence is used as a summary
- A period ends the first sentence
- HTML tags allowed
- The first line beginning with _at_ ends the
general description section and begins the
Javadoc tags
7Javadoc Tags
- General syntax
- _at_lttag-namegt lttextgt
- Tags with the same name must be grouped together
- Some tags have pre-assigned formatting
- Text can contain HTML tags
8Common Javadoc tagsCclass, Iinterface,Mmethod
,VMember Variable
_at_author C,I Specifies author
_at_deprecated C,I,M,V Specifies deprecation
_at_exception M Specifies exception thrown
_at_link C,I,M,V Creates an in line hyperlink
_at_param M Method parameter
_at_return M Return value
_at_see M Creates a hyperlink
_at_since C,I,M,V Specifies version introduced
_at_throws M Same as _at_exception
_at_version C,I States current version
9Example Run