Javadoc Link tag example | Java Documentation example

This tutorial explains how to link external URLs in java documentation comments with examples.

Usually, you can link part of the methods, and classes using a link tag.

If you want to link external URLS or doamins(ex. google) , You need to add anchor links inside java documentation.

@see tag used with anchor tag to link external site. you can use one of the anchor tags to link an external domain or URL.

/**
 * See <a href="http://google.com" >here</a>
 */

or

/**
 * @see <a href="http://www.google.com">Here</a>
 */
You can also add `target="_top"` to the anchor tag to replace and load external URLs on a separate browser page instead of a single frame on the Javadoc web page.

/\*\*

- See <a href="http://google.com" target="_top">Here</a>
- @see <a href="http://www.google.com" target="_top">Here</a>
  _/
  public class Main {
  /\*\*
  _ The entry point of application. \*
  _ @param args the input arguments
  _/
  public static void main(String[] args) {
  System.out.println("Hello World");
  }
  }

Output:

<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">Main</span>
extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">See <a href="http://google.com" target="_top">Here</a></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="http://www.google.com" target="_top">Here</a></dd>
</dl>
</li>
</ul>

There is a @link tag that also links Javadoc methods and classes

@link@see
Create an inline linkcreates a custom section, isolated link
Link other or same classes properties, methods, or constructorsLink external URLS