Objects First With Java - Solutions

Jun 16, 2006 ... Object animal = field.getObjectAt(where); if(animal instanceof Rabbit) { Rabbit rabbit = (Rabbit) animal; if(rabbit.isAlive()) { rabbit.setEaten(); foodLevel = RABBIT_FOOD_VALUE; } } } return where; }. It does not seem to have a big impact. Exercise 10.15. To implement the suggested changes we need a field ...


part of the document



....