Exercises

Bruce Eckel's Thinking in Java Contents | Prev | Next

  1. Create an inheritance hierarchy of Rodent: Mouse, Gerbil, Hamster, etc. In the base class, provide methods that are common to all Rodents, and override these in the derived classes to perform different behaviors depending on the specific type of Rodent. Create an array of Rodent, fill it with different specific types of Rodents, and call your base-class methods to see what happens.
  2. Change Exercise 1 so that Rodent is an interface.
  3. Repair the problem in WindError.java.
  4. In GreenhouseControls.java, add Event inner classes that turn fans on and off.
7



Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds