Question: Analyze the following code Progzam 1: public class Test public ic void ma(SL.ring rgs l Object al new Ai; Object a2 new Ai Sysl.en. o...


Analyze the following code Progzam 1: public class Test public ic void ma(SL.ring rgs l Object al new Ai; Object a2 new Ai Sysl.en. o... .pri nl.1 n (al .equa4:a?)) ; cLass A int z; public boolean equals (Object a Frogram 2: public static void main string args Object a1 = new A'}; Object- a2 = new A3 ; int x public boo.ean qual s[A } return this. a C Program 1 displays rue and Program 2 displays false C Program I displays false and Program 2 displays false Program I displays re ad Progrm 2 displays lrue O Program 1 displays false and Program 2 displays true *What is the output of the following code? public class Test public: d SL.ring] rg ne Personi.prin:Berson new Student).printrerson ass Student extends Person public tring getinto) ass Person public String getinfoi) return "Eerson"; public void prin Person 3ystem.ou.printlnigetinfoi Student Person Student Student Person Student Person Person *What is the output of the following code? public class Test public atat.ic void ma (St.ring args) new Person ) .prin..Pesoni new student i.printPerson cLass Student extends Ferson privace String getIno reurn "3udent"; eass Person private String getinto l) reurn "Person" public void prin Pezso ystem.ou.printinigezinfoil); Person Student Person Person Student Person Student Student
Step by Step Solution
There are 3 Steps involved in it
Lets analyze the code step by step Program 1 java public class Test public static void mainString args Object a1 new A Object a2 new A Systemoutprintl... View full answer
Get step-by-step solutions from verified subject matter experts
