Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Which one is the right answer! ASAP pls 1- What will be the output of the following Java program? public class Animal public int age;
Which one is the right answer! ASAP pls
1- What will be the output of the following Java program? public class Animal public int age; public int position; public Animal{ age=1; position=2; } } public class Bird extends Animal{ String name; public Bird({ super(); } } public class test{ public static void main (String [] args) { Bird obj= new Bird(); System.out.println(obj.age + + obj.position); } NOTE: The attached picture also shows the same code public class Animal TH public int age public int position public Animal age 1 position - 2 public class super use pubile staune void main(String args 0) ( Bed ob ew Bina system.out.println (ob) age + " " + oh . 1 public class Bird extends Animal String name: ( public Bird() super) 1 a) Compilation Error b) 21 Runtime ErrorStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started