Analyze the following code:
```
public class Test {
public static void main(String[] args) {
new B();
}
}
class A {
int i = 7;
public A() {
System.out.println("i from A is " + i);
}
public void setI(int i) {
this.i = 2 * i;
}
}
class B extends A {
public B() {
setI(20);
// System.out.println("i from B is " + i);
}
@Override
public void setI(int i) {
this.i = 3 * i;
}
}```
a. The constructor of class A is not called.
b. The constructor of class A is called and it displays "i from A is 7".
c. The constructor of class A is called and it displays "i from A is 40".
d. The constructor of class A is called and it displays "i from A is 60".
b When invoking new B(), B's superclass A's constructor is invoked first. So it displays i from A is 7.
You might also like to view...
In a chart, the legend can be located here
A) The top of the chart B) The detail sheet C) The summary sheet
What is the maximum supported RAM per virtual machine (VM) in vSphere 6.5?
A. 6128 GB B. 2048 GB C. 8192 GB D. 4096 GB