GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "inheritance" Watch "inheritance" New topic
Author

inheritance

sindura kapur
Greenhorn

Joined: Jul 14, 2008
Posts: 22
can a class extend 4 abstract classes
this statement is true or false i think its false but given as true in one site
Joe Matthew
Ranch Hand

Joined: Jun 10, 2008
Posts: 66
False.

Please try it out to find the answer. Its always best to check it out for yourself rather than relying on Books or people.
[ July 25, 2008: Message edited by: Joe Mathew ]

Regards,<br />Joe<br /> <br />"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live."<br />--Martin Golding
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Well, if the four abstract classes themselves formed an inheritance hierarchy -- i.e., A extends B, B extends C, C extends D, and A-D are all abstract classes, then you could extend A, this making the answer "true". Without more context, it's hard to say what the "right" answer is.


[Jess in Action][AskingGoodQuestions]
Joe Matthew
Ranch Hand

Joined: Jun 10, 2008
Posts: 66
Thats good! Did not think of that!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39053
    
  23
But a class can implement 4 interfaces . . . easy!
 
GeeCON Prague 2014
 
subject: inheritance