/** a container class for Dogs only */ public class Kennel<D extends Dog> { /** * constructor */ public Kennel ( int size ) { ... } public void add ( D dog ) { dog. bark(); ... } } // Now you can now create a Kennel that only holds Dalmatians like this: // The compiler will not let you create a Kennel of Objects Kennel<Dalmatian> spottedDogs = new Kennel<Dalmatian>( 101 ); // If you try to add a Dog or an Object, the compiler will stop you. spottedDogs.add ( new Dalmatian ( "Sparky" ));