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. The constructor of class A is called and it displays "i from A is 60".
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.

Computer Science & Information Technology

You might also like to view...

Answer the following statements true (T) or false (F)

1) Metacharacter ? matches exactly one occurrence of the expression it follows. 2) Method group returns an SRE_Match object. 3) Method re.match does not search through a string, but returns a match object only if the string matches the specified regular expression starting from the beginning. 4) The class [^0–9] matches any digit but 0. 5) Preceding a string with the character r creates a raw string.

Computer Science & Information Technology

____ images are images that you get from a digital camera, from scanning a photograph or a slide, or that you create from scratch.

A. Simulated B. Digital C. Soft D. Hard

Computer Science & Information Technology

Word's default is to print a single copy of an entire document

Indicate whether the statement is true or false

Computer Science & Information Technology

Answer the following statement(s) true (T) or false (F)

1. Photoshop provides a background color option for increased canvas size regardless of whether or not your composition has a Background layer. 2. Whether you choose to load or replace a swatches library depends on the work you’re doing. 3. Once you add a color to the Swatches panel, you can apply it as you would apply any other color. 4. When you delete a swatch from a library, the deletion is permanent whether or not you save the library.

Computer Science & Information Technology