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Â &...