I have the Sun Certified Programmer and Developer for
Java 2 Study Guide book by Kathy Sierra and Bert Bates. This question is from Chapter 2, #3.
Here's the question:
3. Given the following:
1. abstract class A {
2. abstract short m1();
3. short m2() { return (short) 420; }
4. }
5.
6. abstract class B extends A {
7. // missing code ?
8. short m1() { return (short) 42; }
9. }
which three of the following statements are true? (Choose three.)
A. The code will compile with no changes.
B. Class B must either make an abstract declaration of method m2() or implement method m2() to allow the code to compile.
C. It is legal, but not required, for class B to either make an abstract declaration of method m2() or implement method m2() for the code to compile.
D. As long as line 8 exists, class A must declare method m1() in some way.
E. If line 6 were replaced with 'class B extends A {' the code would compile.
F. If class A was not abstract and method m1() on line 2 was implemented, the code would not compile.
The answer key says that A, C, and E are correct and I agree. But isn't F also correct? Even if m1() were implemented, it is still declared as abstract, but since class A is not abstract, the code would not compile. Or am I missing something?
Thanks for anybody who can help!