PPT Slide
Subclasses
(Dog extends Animal
i.e. “A dog is an animal” or
“All dogs are animals”)
class Dog extends Animal {
public Dog() {
strNoise = “Woof”;
} // of constructor
public void doYourThing ( ) {
identifySelf();
System.out.println(“I am a dog”);
System.out.println(strNoise);
} // of doYourThing
} // of Dog
Recall: The Animal class had a no-op method for doYourThing()
Previous slide
Next slide
Back to first slide
View graphic version