Analyze the following code:
```
public class Test {
public static void main(String[] args) {
new B();
}
}
class A {
int i = 7;
public A() {
setI(20);
System.out.println("i from A is " + i);
}
public void setI(int i) {
this.i = 2 * i;
}
}
class B extends A {
public B() {
// 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".
d When invoking new B(), B's superclass A's constructor is invoked first. It invokes setI(20). The setI method in B is used becasue object created is new B(). The setI method in B assigns 3 * 20 to i. So it displays i from A is 60.
You might also like to view...
When a LAN switch is used, the resulting topology is
a. star network b. mesh network c. bus network d. ring network
It is necessary to use equal signs in arguments
Indicate whether the statement is true or false
Critical Thinking QuestionsCase A-1Will just purchased Adobe Illustrator for his home office. He has installed it and is ready to get started by familiarizing himself with the program. He has not used Illustrator for years and it has changed a bit since then. Will wants to look at all of the possible workspace styles available so he clicks the workspace switcher on the ____.
A. Menu bar B. Status bar C. Control panel D. Workspace bar
Which of the following is true?
A) PCs typically have 16 I/O addresses numbered 0 through 15. B) Every device must have a unique I/O address. C) I/O addresses are used to allow an adapter to bypass the processor and communicate directly with the RAM chips. D) Similar adapters and devices are assigned the same I/O address.