|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Human
public class Human
A Human has a name and an age. A human's name can be changed at any time. A human's age only changes when the human has a birthday.
Constructor Summary | |
---|---|
Human(java.lang.String initName)
Creates a human with the given name. |
Method Summary | |
---|---|
int |
getAge()
Returns the age of this human. |
java.lang.String |
getName()
Returns the name of this human. |
void |
haveBirthday()
Causes the human to have a birthday (i.e., adds a year to the age). |
void |
setName(java.lang.String newName)
Changes the name of this human to the new name given. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Human(java.lang.String initName)
initName
- the name to give the humanMethod Detail |
---|
public java.lang.String getName()
public int getAge()
public void setName(java.lang.String newName)
newName
- the new name for the humanpublic void haveBirthday()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |