Question: 5. What will be the output of the following Java program? public class Animal public int age; public int position; public Animalo age=1; position=2; }


5. What will be the output of the following Java program? public class Animal public int age; public int position; public Animalo age=1; position=2; } public class Bird extends Animal String name; public Birdo super(); } } public class test public static void main (String I args) { Bird obj= new Birdo; System.out.println(obj.age + obj.position); } } + NOTE: The attached picture also shows the same code public class Animal public int age, public int position: public Animal ( [ age 1 position 2 pablie class super_use / public static void main(String args[]) Bird ob] = new Bird() System out.println(obj.age + +++ 3 public class Bird extends Animali String nane. NOTE: The attached picture also shows the same code public elass Animal public int age: public int position: publie Animal ( [ age 1; position - 2: 1 public class super_use t public static void main(string args[])! Bird ob) = new Bird() : System.out.println (obj.age + obj. position) public class Bird extends Animal( String name: public Bird ( [ super(); a) Compilation Error b) 12 Runtime Error 21 Leave blank
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
