Question: Given the following Java code: public class A { private int x = 30; } public class B extends A{ public void b(){ System.out.print(x); }

 Given the following Java code: public class A { private intx = 30; } public class B extends A{ public void b(){System.out.print(x); } } what would be the result of the statements: B

Given the following Java code: public class A { private int x = 30; } public class B extends A{ public void b(){ System.out.print(x); } } what would be the result of the statements: B b = new B(); b.b(); In the following Java code fragment: public class MyClass { public void a() { int p; p = 98; } public void b() { al); /* state of p here?*/ } } Given these class definitions: public class A { public A(int x) { System.out.print(x); } } public class B extends A{ public B() { super(1); System.out.print("B"); } } what is printed out by the following Java statement: A a = new B()

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!