• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

An abstract class can not extend a concrete class?

 
Ranch Hand
Posts: 522
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
In one of Dan's exams i came across the following statement:
An abstract class can not extend a concrete class.
I thought this statement was true, but according to Dan it is wrong, so i wrote the following code

The code compiles fine without error, which means my answer is correct. Did Dan made a mistake with this question? (Which is highly unlikely) or i simply misunderstood the meaning of concrete class?
I don't see the point why an abstract class should not extend another class!!!
Any help will be appreciated.
 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vicken,
It is true that an abstract class can extend a concrete class.
So I went in search of where Dan might have said otherwise. Here is Dan�s Single Topic Exams, Chapter 4, Exam 1, Question 15. See option f.
Which of the follow statements is true.
a. An anonymous class can be declared abstract.
b. A local class can be declared abstract.
c. An abstract class can be instantiated.
d. An abstract class is implicitly final.
e. An abstract class must declare at least one abstract method.
f. An abstract class can not extend a concrete class.
Here is Dan�s Answer:
15 b A local class can be declared abstract.
An anonymous class can not be extended; therefore, an anonymous class can not be declared abstract. A local class can be abstract. An abstract class can not be instantiated. If a class declaration contains an abstract method, then the class must also be declared abstract. A class can be declared abstract even if it does not contain an abstract method. An abstract class can never be declared final.
Therefore, in this question and answer Dan is saying f is false.
Dan's Single Topic Exams, Chapter 4, Exam 1
Dan's Single Topic Exams, Chapter 4, Exam 1, Answers
 
Vicken Karaoghlanian
Ranch Hand
Posts: 522
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi MM,
The qestion i posted was from Dan's Study Guide (April 18), Exam-2, Question 14


Which of the follow are true statements.
a. An anonymous class can be declared abstract.
b. An incompletely implemented class must be declared abstract.
c. A local class can be declared abstract.
d. An abstract class can be instantiated.
e. An abstact class is implicitly final.
f. An abstact class must declare at least one abstract method.
g. An abstact class can not extend a concrete class.
h. None of the above.

Dan's Answers are: b,c
An anonymous can not be extended therefore an anonymous class can not be declared abstract. Even a local class can be abstract. An abstract class can not be instantiated. Any class that declares an abstract method must also be abstract. A class can be declared abstract even if it does not declare an abstract method. An abstract class can never be declared final.


I checked Dan's site and it seems that the question does not exist anymore. He may have corrected the answer in his latest update (Dec 20).
Thanks MM.
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vicken,
In the example you cite, the answer says b and c are true statements, hence g is false. Since g is false, the answer is saying an abstract class can extend a concrete class.
g. An abstact class can not extend a concrete class.
I think the problem here is just sorting out which statements are true and which are false.
[ December 26, 2003: Message edited by: Marlene Miller ]
 
Vicken Karaoghlanian
Ranch Hand
Posts: 522
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you are right MM, it seems that i missed the not in that statement .After all Dan was right and i was wrong. I should take a little brake, cause sitting hours and hours in front of the PC is definitely not helping.
So simply put, the statement: An abstract class can not extend a concrete class. is FALSE.
[ December 26, 2003: Message edited by: Vicken Karaoghlanian ]
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah. I think you have discovered the root of the problem.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic