public class Pet { private String name; private int agressiveness; ... // some public methods } public class Dog extends Pet { // class stuff } public class Cat extends Pet { // class stuff } public class Collie extends Dog { // class stuff } public class Poodle extends Dog { // class stuff } public class Kennel { public void giveBath( Pet pet ) { /* code here */ } } public class KennelDemo { public static void main (String[ ] args ) { Kennel myKennel = new Kennel( ); Pet myPet = new Pet( ); Dog myDog = new Dog( ); Cat myCat = new Cat( ); Collie myCollie = new Collie( ); Poodle myPoodle = new Poodle( ); myKennel.giveBath( myPet ); myKennel.giveBath( myDog ); myKennel.giveBath( myCat ); myKennel.giveBath( myCollie ); myKennel.giveBath( myPoodle ); }