Question 22
Consider the following Java code.
1. class Animal {2. protected final void makeSound() {3. System.out.println("Animal makes sound");4. }5. }6. class Bird {7. public void fly() {8. System.out.println("Bird flies");9. }10. }11. class Dog extends Animal{12. public void makeSound(){13. System.out.println("Dog barks");14. }15. }16. class Parrot extends Animal, Dog{17. }18. public class Test {19. public static void main(String[] args) {20. Parrot p1 = new Animal();21. Animal a1 = new Dog();22. }23. }Identify the line/s which has/have errors.
Line 2
Line 7
Line 11
Line 12
Line 16
Line 20
Line 21