aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question#3 in K&B book question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question#3 in K&B book question" Watch "Question#3 in K&B book question" New topic
Author

Question#3 in K&B book question

Francis Palattao
Ranch Hand

Joined: Sep 22, 2004
Posts: 91
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


SCJP 1.4 <br />SCWCD 1.4 (preparing)<br />SCBCD 1.3 (coming soon)
David Fowler
Greenhorn

Joined: Nov 11, 2004
Posts: 1
No, an abstract class can extend a concrete class. If you think about it, the original abstract class A extended Object which is a concrete class.
Francis Palattao
Ranch Hand

Joined: Sep 22, 2004
Posts: 91
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question#3 in K&B book question