Question: public class A private int private int x = 1 : y = 2 public class B extends A { private int x = 3

public class A
private int private int x =1: y =2
public class B extends A {
private int x =300 private int z =400
public int m{
public int m (){
return x + y
return super.m m ()+z;
}
public int x({
return x;
public int x20){ return 2 this.x(;
}
}
Consider the following code:
A a1= newA ();
A a2= newB() ; For each expression below, write the type of the expression. Write "Unknown" if it is impossible to determine the type from the code fragment given. Write "Illegal" if the expression is never allowedinJava.
B a3= 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!