• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

a question from Biran's book

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A class with an abstract method must have the keyword abstract in its class definition. You are correct that the question contains an error.
 
Li Wenfeng
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic