Analyze the following code:

```
public class Test extends A {
public static void main(String[] args) {
Test t = new Test();
t.print();
}
}

class A {
String s;

A(String s) {
this.s = s;
}

public void print() {
System.out.println(s);
}
}
```
a. The program does not compile because Test does not have a default constructor Test().
b. The program has an implicit default constructor Test(), but it cannot be compiled, because its super class does not have a default constructor. The program would compile if the constructor in the class A were removed.
c. The program would compile if a default constructor A(){ } is added to class A explicitly.
d. The program compiles, but it has a runtime error due to the conflict on the method name print.


b. The program has an implicit default constructor Test(), but it cannot be compiled, because its super class does not have a default constructor. The program would compile if the constructor in the class A were removed.
c. The program would compile if a default constructor A(){ } is added to class A explicitly.

Computer Science & Information Technology

You might also like to view...

When the loop is finished stepping through the values array, what value will be stored in values[0]?

Look at the following code sample: ``` const int SIZE = 10; int[] values = new int[SIZE]; for (int index = 0; index < SIZE; index++) { values[index] = index + 1; } ``` a. 10 b. 11 c. 0 d. 1

Computer Science & Information Technology

C#, string objects have a method named ____________ that is used to tokenize strings.

a. Tokenize b. Delimit c. Break d. Split

Computer Science & Information Technology

If you encounter the blue screen of death, ____.

A. the computer no longer can accept commands B. the operating system has a critical error C. you might need to contact a technical support person D. All of the above.

Computer Science & Information Technology

Interactivity occurs between

a. The scripts. b. The objects. c. The navigational tools. d. The events. e. All of the above. f. a and b.

Computer Science & Information Technology