This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 24183
    
  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: 37907
    
  22
But a class can implement 4 interfaces . . . easy!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: inheritance
 
Similar Threads
plz need help
You can directly run the GC whenever you want to ?????
Short Circuit AND
Double doubt
only static methods can access static members