Question: Given the following classes: public class A { private int x = 1 5 public class B extends A private int x = 1 0
Given the following classes:
public class A
private int x
public class B extends A private int x ; private int z
private int y
public int sum return x y
public int sum
return super.sum z
public int getX return this.x;
public int getX return this.getXthisx;
Consider the following code:
B a new B; A a new B;
For each expression below, indicate the result of the expression. Write "Illegal" for the result if the expression is not allowed.
EXPRESSION
agetX
BagetX
agetX
BagetX
asum
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
