@link
tag is used to create inline links that can refer to the documentation for the
specified package, class, or member name of a referenced class.
Syntax
{@link
package.class#member label}
Refer constant of
same class
/**
* Calculates the area of circle. It uses value
of {@link #PI} in
* calculation.
*
*/
public
double areaOfCircle(int radius);
Refer method of same
class
/**
* Prints the area of circle. It internally
calls {@link #areaOfCircle(int)}
* method
*
*/
public
void printAreaOfCircle(int radius);
Refer method of other
class
/**
* Calculate the squalre root of the parameter
a. It internally calls
* {@link java.lang.Math#sqrt(double)}
*
* @return square root of a
*/
public
default double sqrt(double a) {
return Math.sqrt(a);
}
Find
the below example.
Arithmetic.java
package com.java.tags; /** * * @author Hari Krishna * * @since 1.0 */ public interface Arithemtic { /** * The value of PI is {@value} */ public static final double PI = 3.14; /** * Calculates the area of circle. It uses value of {@link #PI} in * calculation. * * @param radius * Radius of the Circle * * @return area of the circle. * * @since 1.1 */ public double areaOfCircle(int radius); /** * Prints the area of circle. It internally calls {@link #areaOfCircle(int)} * method * * @param radius * Radius of the Circle. */ public void printAreaOfCircle(int radius); /** * Calculate the squalre root of the parameter a. It internally calls * {@link java.lang.Math#sqrt(double)} * * @param a * Operand * @return square root of a */ public default double sqrt(double a) { return Math.sqrt(a); } }
No comments:
Post a Comment