Documenting with JavaDoc
Javadoc is a tool that comes with the JDK that can be used to generate documentation of classes directly from properly commented code. It requires the use of a specific type of commenting that is different from the ones seen in Chapter 1, Getting Started. There, we saw that comments can be added to code using either //
or /*
or */
. JavaDoc uses a specific type of marking to detect what comments were intentionally made for documentation purposes. Javadoc comments are contained within /**
and */
.
A simple example follows.
Example18.java
1 /** 2 * Anonymous class example 3 * This example shows the declaration of an inner class extending 4 * an existing class and overriding a method. It can be used as a 5 * technique to modify an existing method for something more suitable 6 * to our purpose. 7 * 8 * @author Joe Smith 9 &...