Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes a question from Biran's book Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "a question from Biran Watch "a question from Biran New topic

a question from Biran's book

Li Wenfeng

Joined: Aug 26, 2002
Posts: 22
It's a question about abstract class.

1. class A{
2. abstract int getNum();
3. }
And the following:
5. public static int pi=3;
6. int getNum(){
7. return 5;
8. }
9. }
The second file can be compiled successfully by inserting a line of code on line 4. Which of the following lines will allow compilation to succeed? (Choose all that apply.)
A. class B extends A{
B. abstract class B extends A{
C. final abstract class B extends A{
D. final class B extends A{
E. abstract class B{

My answer is E, but Biran gives the answer of A,B,D,and E. If the keyword abstract was added in front of line 1, then I think his answer is right.
However,in the preceding question, class A will not be compiled at all! Biran made another mistake, so I will compile and run the sample questions about which I am not sure to really grasp every objective!
[ August 31, 2002: Message edited by: Li Wenfeng ]

Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
A class with an abstract method must have the keyword abstract in its class definition. You are correct that the question contains an error.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Li Wenfeng

Joined: Aug 26, 2002
Posts: 22
who are using Biran's scjp book: 《Sun Certified Programmer for Java 2 Study Guide,Second Edition(Exam:310-025)》? I found quite a lot of errors in his book? Anyway, he indeed give the details of conceptes for the picky SCJP2 exam. But he did not provide feedback forms, or errata page!
[ August 31, 2002: Message edited by: Li Wenfeng ]
I agree. Here's the link:
subject: a question from Biran's book
Similar Threads
Valiveru's Mock Exam: Question #7
overriding / overloading
Nested Classes Test
RE:Question from K&B book