|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthamster.Hamster
public class Hamster
A simple class that represents a hamster. The minimum age for a hamster is initially 100 days, but class provides a method for clients to change this value.
Constructor Summary | |
---|---|
Hamster()
Creates a hamster with name and age of the previous hamster created. |
|
Hamster(String name,
int age)
Creates a hamster with a given name and age. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
Compares two hamsters for equality. |
int |
getAge()
Get the hamster age. |
static int |
getMinimumAge()
Get the minimum age in days for a hamster. |
String |
getName()
Get the hamster name. |
boolean |
setAge(int age)
Set the age of the hamster. |
static boolean |
setMinimumAge(int age)
Set the minimum age in days for a hamster. |
boolean |
setName(String name)
Set the name of the hamster. |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Hamster()
public Hamster(String name, int age)
name
- The desired name of the hamster.age
- The desired age of the hamster.Method Detail |
---|
public static int getMinimumAge()
public static boolean setMinimumAge(int age)
age
- The minimum hamster age.
public String getName()
public int getAge()
public boolean setName(String name)
name
- The desired name of the hamster.
public boolean setAge(int age)
age
- The desired age of the hamster.
public boolean equals(Object obj)
equals
in class Object
obj
- The object to compare with.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |