Analyze the following code:

```
public class Test {
public static void main(String[] args) {
B b = new B();
b.m(5);
System.out.println("i is " + b.i);
}
}

class A {
int i;

public void m(int i) {
this.i = i;
}
}

class B extends A {
public void m(String s) {
}
}```
a. The program has a compile error, because m is overridden with a different signature in B.
b. The program has a compile error, because b.m(5) cannot be invoked since the method m(int) is hidden in B.
c. The program has a runtime error on b.i, because i is not accessible from b.
d. The method m is not overridden in B. B inherits the method m from A and defines an overloaded method m in B.


d

Computer Science & Information Technology

You might also like to view...

In Java, a reference variable is __________ because it can reference objects of types different from its own, as long as those types are related to its type through inheritance.

a. static b. dynamic c. polymorphic d. public

Computer Science & Information Technology

The three virtual switch types to select from are External, Internal, and ________

a. Normal b. Physical c. Private d. None of the above

Computer Science & Information Technology

?A _____ is a series of events and activities with no slack time.

A. ?risk path B. ?foundation path C. ?baseline path D. ?critical path

Computer Science & Information Technology

Initially, the most common magnetic disk storage device was the removable floppy disk.

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

Computer Science & Information Technology