Question: Please Answer Both MCQs, it will really help. Thank you. What would be the values of c.x and c.get x() ? c.x: , c.getX(): class

Please Answer Both MCQs, it will really help. Thank you.

Please Answer Both MCQs, it will really help. Thank you. What would

be the values of c.x and c.get x() ? c.x: , c.getX():

What would be the values of c.x and c.get x() ? c.x: , c.getX(): class C1{ int x=2; protected int get XO{ return x;} public static void main(String[] args) \{ \} class C2 extends C1 \{ int x=0; public C2O x=3; super. x=5 \} public int getXo \{retum x; \} C1c= new C2O; System.out.println(c.x); System.out.println(c.getXO); \} \} \} What would be the outputs of p.i and p.j? p.i: , p.j: public class P{ int i=5; int j=10; public int getIO \{return i; \} public int get JO{ retum j; \} \} public class Test \{ public static void main(String[] args) \{ Pp= new CO; System.out.println(p.i + ", " + p.j); \} \} public class C extends P \{ int j=15; public CO \{ super. j=20; } public int getJO 0 return j; \} \}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!