{

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 link creates a custom section, isolated link
Link other or same classes properties, methods, or constructors Link external URLS
THE BEST NEWSLETTER ANYWHERE
Join 6,000 subscribers and get a daily digest of full stack tutorials delivered to your inbox directly.No spam ever. Unsubscribe any time.

Similar Posts
Subscribe
You'll get a notification every time a post gets published here.