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. The method m is not overridden in B. B inherits the method m from A and defines an overloaded method m in B.
You might also like to view...
Which of the following is not an object of the ostream class?
a. cout b. cerr c. cin d. clog
Objects are represented by and grouped into ________ that are optimal for reuse and maintainability.
A) objects B) views C) classes D) displays
A static method can ________.
a. call only other static methods of the same class directly b. manipulate only static fields in the same class directly c. be called using the class name and a dot (.) d. All of the above.
The four terms that describe the design basis of the Unicode Standard are _____, ________ ,_____ and _________.
Fill in the blank(s) with the appropriate word(s).