OCJP 21 (1Z0-830) - Inheritance and Polymorphism - 100 MCQs Question 1
What is the output?
class Animal {
void sound() { System.out.println("Animal"); }
}
class Dog extends Animal {
void sound() { System.out.println("Dog"); }
public static void main(String[] args) {
Animal a = new Dog();
a.sound();
}
}