Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the @linkplain tag used for and how does it differ from @link

Tags:

java

javadoc

I am wondering what exactly is the difference of the JavaDoc tags @link and @linkplain.

They both seem to generate the same html code.

like image 997
kerner1000 Avatar asked Mar 13 '18 12:03

kerner1000


People also ask

What is @link in Java?

It is shorthand that tells the java docs to insert a link to the desired place when they are being viewed. For instance when you view the javadocs for whatever method has that inside your IDE you'll be shown a link that will take you to the KeyEvent.

What is @linkplain?

{@linkplain} : Forces the link's text to appear as normal text, without a monospace font.

How do you write a Javadoc comment for a method?

Writing Javadoc Comments In general, Javadoc comments are any multi-line comments (" /** ... */ ") that are placed before class, field, or method declarations. They must begin with a slash and two stars, and they can include special tags to describe characteristics like method parameters or return values.


2 Answers

It produces different formatting in javadoc you can try it in IDE:

{@link #method()} - monospaced formatting (code)

{@linkplain #method()} standard formatting

like image 147
Maciej Avatar answered Sep 23 '22 14:09

Maciej


From Oracle documentations:

@link

Inserts an in-line link with visible text label that points to the documentation for the specified package, class or member name of a referenced class. This tag is valid in all doc comments: overview, package, class, interface, constructor, method and field, including the text portion of any tag (such as @return, @param and @deprecated).

@linkplain

Identical to {@link}, except the link's label is displayed in plain text than code font. Useful when the label is plain text.

like image 20
ultraon Avatar answered Sep 24 '22 14:09

ultraon