Question #3 in K&B book
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.
answer ACE
Is F also an answer because if class A was not abstract, class B cannot extend the concrete class because it is also abstract. compile error
Thanks
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.
answer ACE
Is F also an answer because if class A was not abstract, class B cannot extend the concrete class because it is also abstract. compile error
Thanks