I just found out I can write "{@value}" in the comment of a public static final field to insert the actual field value into the comment. Example:
/** The value of this field is {@value}. */
public static final int someField = 3
In Eclipse, this comment is displayed as "The value of this field is 3". Another trick is to write "{@code some-code}" in order to insert code into a comment.
Is there a complete list of these special comment tags somewhere? I couldn't find one...
5 - Comments. Java programs can have two kinds of comments: implementation comments and documentation comments. Implementation comments are those found in C++, which are delimited by /*... */, and //.
In Java there are three types of comments: Single-line comments. Multi-line comments. Documentation comments.
Comments in Java are used to provide some extra information about the code. Single line, multi-line and documentation are the three ways to present the comments in Java.
Multi-line comments start with /* and ends with */ . Any text between /* and */ will be ignored by Java.
This should get you started:
Note the -tag
option though. Tags are extensible, so there's no such thing as a complete list.
For Java 12: Documentation Comment Specification for the Standard Doclet
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With