Reading Class Documentation
Key question:
For any class, how do we know
- what methods are available,
- whether they are Do-Something or Return-Something methods,
- and whether they need information passed to them?
Read the Class Documentation!
Class documentation pages are generated by a tool called
javadoc
from the javadoc comments in
a Java source file. These are the comments that start with two
asterisks (/** ... */
) that come before the class
and before each method.
Class Documentation Structure
Every class documentation page has a similar structure.
- Overall class information, including a description of the purpose of
the class, plus @author and @version information.
- Constructor Summary: brief
summary of every constructor
- Method Summary: brief
summary of every method
- Constructor Detail:
full description and details about expected parameters
- Method Detail:
full description and details
about expected parameters and the return value
- A class documentation page also has information about how the class
relates to other classes.
Example: Simplified Clock Class
Alyce Brady, Kalamazoo College