15 lines
413 B
Java
15 lines
413 B
Java
public class Dog extends Animal {
|
|
// java requires an explicit constructor when the supertype awaits parameters in the constructor
|
|
public Dog(String name) {
|
|
// call supertype constructor
|
|
super(name);
|
|
}
|
|
|
|
// override the method make_sound
|
|
public void make_sound() {
|
|
// implement own functionality
|
|
System.out.println("doggo " + this.name + " says:");
|
|
System.out.println("woof!");
|
|
}
|
|
}
|