Java Reference
In-Depth Information
private static final ObjectStreamField[] serialPersistentFields
= {new ObjectStreamField("name", String.class),
new ObjectStreamField("height", double.class)
};
}
@since <description>
The
@since
tag adds a Since section to the documentation. The specified
description
indicates the release of the
software that added the program element being documented. The following documentation comment shows how to
use
@since
tag:
/**
* A dummy class.
*
* @since 1.0
*/
public class Dummy {
}
@throws <class-name> <description>
The
@throws
tag is a synonym for
@exception
tag. It adds a Throws section to the documentation. It is used to
describe an exception that may be thrown from a constructor or a method. Multiple
@throws
tag can be used in
a documentation comment. If a method throws a checked exception and there is no
@throws
tag, the
javadoc
tool will add one without a description to make sure that all checked exceptions are documented. The following
documentation comment for the
divide()
method shows how to use the
@throws
tag. If you do not provide the fully
qualified name of the class, the
javadoc
tool will use the same search order as used by the Java compiler to resolve
the partial class name.
/**
* Returns the result of integer division of <code>n1</code> by
* <code>n2</code>.
*
* @param n1 The dividend
* @param n2 The divisor
* @return Returns the result of <code>n1 / n2</code>
* @throws ArithmeticException If <code>n2</code> is zero.
*/
public static int divide(int n1, int n2) throws ArithmeticException {
return n1 / n2;
}