• Post Reply Bookmark Topic Watch Topic
  • New Topic

inheritance  RSS feed

 
sindura kapur
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Joe Matthew
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats good! Did not think of that!
 
Campbell Ritchie
Sheriff
Posts: 53779
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But a class can implement 4 interfaces . . . easy!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!