What is the difference between {@code memberData}
and <code>memberData</code>
in JavaDoc
{@code} is a Javadoc tag that came with Java 5. A code snippet embedded within {@code} will display our special characters correctly so they don't need to be manually escaped. However, indentation and line breaks will be lost. This can be rectified by using {@code} together with <pre> , though (see next section).
Javadoc provides the @link inline tag for referencing the members in the Java classes. We can think of the @link tag as similar to the anchor tag in HTML, which is used to link one page to another via hyperlinks. Similar to the anchor tag, the path_to_member is the destination, and the label is the display text.
Use the standard style for the Javadoc comment Javadoc only requires a '/**' at the start and a '*/' at the end. In addition to this, use a single star on each additional line: /** * Standard comment. */ public ... /** Compressed comment.
There are two main differences:
{@code ...}
is more concise: easier to read (and type).
Text within {@code ...}
will be automatically HTML-escaped for you.
For example, {@code List<String>}
is equivalent to <code>List<String></code>
.
See also the documentation for {@code}
.
The {@code}
is equivalent to <code>
except that it uses allows you to use angle brackets <
and >
instead of HTML-entities <
and >
.
Example:
{@code LinkedList<String>}
The Javadoc knows how to interpret it as <code>
without the need of generating HTML.
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