Java - Polymorphism
What will be the output of the following Java code?
class Animal {
void sound() { System.out.println("Animal sound"); }
}
class Dog extends Animal {
void sound() { System.out.println("Dog barks"); }
}
public class Test {
public static void main(String[] args) {
Animal a = new Dog();
a.sound();
}
}