value = newValue;
return oldVal;
}
/**
- Returns a string of the form
name=value
.
*/
public String toString() {
return name + "='" + value + "'";
}
}
For simple methods like getName, whose whole description is what it returns, the @return tag is often
omitted as overkill. Similarly, the constructors do not use @param tags because the description is sufficiently
complete. Different organizations will make different choices of when to use each tag.
You should use doc comments to document all members, including private and package-accessible ones.
Documentation generators such as javadoc let you specify whether you want to generate documentation
from these comments. Having organized, readable documentation of your class's internals is quite useful when
someone else needs to learn about them.
On the following two pages, you can see how the generated HTML javadoc output might look for this class.
[View full size image]