File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "a question from Biran Watch "a question from Biran New topic
Author

a question from Biran's book

Li Wenfeng
Greenhorn

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

Given:
1. class A{
2. abstract int getNum();
3. }
And the following:
4.
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 ]

SCJP2
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
Greenhorn

Joined: Aug 26, 2002
Posts: 22
hi,all
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: http://aspose.com/file-tools
 
subject: a question from Biran's book
 
Similar Threads
overriding / overloading
Inheritance
Nested Classes Test
RE:Question from K&B book
Valiveru's Mock Exam: Question #7