K.3. Documenting Java Source Code
In this section, we document a modified version of the Time2 class from Fig. 8.5 using documentation comments. In the text that follows the example, we thoroughly discuss each of the javadoc tags used in the documentation comments. In the next section, we discuss how to use the javadoc tool to generate HTML documentation from this file.
Documentation comments are placed on the line before a class declaration, an interface declaration, a constructor, a method and a field (i.e., an instance variable or a reference). The first documentation comment (lines 5–9) introduces class Time. Line 6 is a description of class Time provided by the programmer. The description can contain as many lines as necessary to provide ...
Get Java™ How to Program, Seventh Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.