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