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.

Computer Science & Information Technology

You might also like to view...

In the classic pattern for ____-state behavior, an object can switch from one state to another.

A. one B. two C. three D. four

Computer Science & Information Technology

If a CheckBox is “on” (checked), its __________ property is True; otherwise, it’s False (“off”).

a) Selected b) On c) Chosen d) Checked

Computer Science & Information Technology

What fraction of state legislators around the country would be required to ratify a Constitutional amendment in order for it to pass?

What will be an ideal response?

Computer Science & Information Technology

Give four examples of common help desk performance measures.

What will be an ideal response?

Computer Science & Information Technology