Geek Geek - 6 months ago 25
HTML Question

<tt> vs <code> elements when writing Java docs

To represent

keywords
while writing Java Docs should I use the
<code>
element or the
<tt>
element? Are there specific situations when one should be preferred over the other?

Answer

For inline code in Javadocs,you should use {@code your-code-here}

See javadoc - {@code text} for more details.

Equivalent to <code>{@literal text}</code>.

Displays text in code font without interpreting the text as HTML markup or nested javadoc tags. ..