Javadoc ignores comments unless they are specially marked. A Javadoc comment is marked with an extra asterisk after the start of a multi-line comment: /**. A comment block pertains to the symbol that follows the block.
An example of a class header block follows:
For a method, the first line is a short description of the method. If more detail is warranted, then it may be followed by a longer description in additional paragraphs. Following that are optionally various tags.
Various aspects of HTML as supported via Javadoc. For example <p> denotes a paragraph break.
An example of a method header block follows:
Variables can also be documented. For example:
A more complete example follows:
From Java 23 onwards, Javadoc supports the Markdown standard CommonMark on comment lines that start with /// instead of the older multiline format. 6
A Doclet program works with Javadoc to select which content to include in the documentation, format the presentation of the content and create the file that contains the documentation.7 A Doclet is written in Java and uses the Doclet API,
The StandardDoclet[1] included with Javadoc generates API documentation as frame-based HTML files. Other Doclets are available on the web , often for free. These can be used to:
Some of the available Javadoc tags8 are listed in the table below:
"Javadoc". agile.csc.ncsu.edu. Archived from the original on 13 June 2017. Retrieved 12 January 2022. https://web.archive.org/web/20170613233020/http://agile.csc.ncsu.edu/SEMaterials/tutorials/javadoc/ ↩
"javadoc - The Java API Documentation Generator". Sun Microsystems. Retrieved 2011-09-30.. http://docs.oracle.com/javase/1.5.0/docs/tooldocs/solaris/javadoc.html ↩
IntelliJ IDEA, NetBeans Archived 2017-04-05 at the Wayback Machine and Eclipse https://www.jetbrains.com/idea/ ↩
Venners, Bill; Gosling, James; et al. (2003-07-08). "Visualizing with JavaDoc". artima.com. Retrieved 2013-01-19. When I did the original JavaDoc in the original compiler, even the people close around me pretty soundly criticized it. And it was interesting, because the usual criticism was: a good tech writer could do a lot better job than the JavaDoc does. And the answer is, well, yeah, but how many APIs are actually documented by good tech writers? And how many of them actually update their documentation often enough to be useful? http://www.artima.com/intv/jackpot3.html ↩
"How to Write Doc Comments for the Javadoc Tool". Sun Microsystems. Retrieved 2011-09-30.. http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html ↩
https://openjdk.org/jeps/467 https://openjdk.org/jeps/467 ↩
"Doclet Overview". https://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/doclet/overview.html ↩
JavaSE 13 Documentation Comment Specification https://docs.oracle.com/en/java/javase/13/docs/specs/javadoc/doc-comment-spec.html ↩