Java Reference
In-Depth Information
19.4. A Simple Example
The following is a version of the Attr class from page 76 with an example
of javadoc comments:
/**
* An <code>Attr</code> object defines an attribute as a
* name/value pair, where the name is a <code>String</code>
* and the value an arbitrary <code>Object</code>.
*
* @version 1.1
* @author Plato
* @since 1.0
*/
public class Attr {
/** The attribute name. */
private final String name;
/** The attribute value. */
private Object value = null;
/**
* Creates a new attribute with the given name and an
* initial value of <code>null</code>.
* @see Attr#Attr(String,Object)
*/
public Attr(String name) {
this.name = name;
}
/**
* Creates a new attribute with the given name and
* initial value.
* @see Attr#Attr(String)
*/
public Attr(String name, Object value) {
this.name = name;
this.value = value;
}
 
Search WWH ::




Custom Search