Java Reference
In-Depth Information
The following documentation comment demonstrates the use of {@ inheritDoc} tag. It is used inside the
documentation comment for the getId() method of the SmartPerson class. It is used inside the main description
as well as the text section of the @return tag. Note that the @param tag is missing from the getId() method of
SmartPerson class. The javadoc tool will automatically copy the documentation for the @param tag from the getId()
method of the Person class.
/**
* A class to represent a person
*/
public class Person {
/**
* Returns the person id.
* @param x The value to add to the id
* @return The person id.
*/
public int getId(int x) {
return x + 10;
}
}
/**
* A class to represent a smart person
*/
public class SmartPerson extends Person {
/**
* {@inheritDoc}
* @return {@inheritDoc}
*/
public int getId(int x) {
return 20 + x;
}
}
The generated documentation for the getId() method of the SmartPerson class is as follows:
getId
public int getId (int x)
Returns the person id.
Overrides:
getId in class Person
Parameters:
x - The value to add to the id
Returns:
The person id.
 
Search WWH ::




Custom Search