|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object animals.Cat
public class Cat
A domestic Cat which has a name, may be hungry, and eats Bunnys.
This class is very stupid; its instance variables (aka fields) are public.
Field Summary | |
---|---|
boolean |
hungry
is the cat hungry true or not hungry false |
java.lang.String |
name
Cat's given name |
Constructor Summary | |
---|---|
Cat()
|
Method Summary | |
---|---|
void |
eat(Bunny food)
eat a Bunny, changing its name to Ex-Bunny. |
void |
miaow()
The cat makes a noise. |
java.lang.String |
toString()
Generate what we get if we cast Cat to String |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public java.lang.String name
public boolean hungry
true
or not hungry false
Constructor Detail |
---|
public Cat()
Method Detail |
---|
public void miaow()
public void eat(Bunny food)
cat1.eat(bunny1);
- Parameters:
food
- the Bunny to be eaten by the Cat
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |