• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAVA SUPPORTS MULTIPLE INHERITANCE

 
Nikhilesh Fonseca
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was wondering since every object extends from Object Class ..so if one class extends from another it already extends from the Object class.
Shouldnt this line be more Java doesnt support user defined multiple inheritance..
 
Dave Alkire
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, that would be like saying that Kitty is two different things at once because he's both a cat and an animal. But he isn't two different things at once, because Cat is-a Animal. Now to say that Kitty were simultaneously a cat and a horse, that would be like multiple inheritance.
 
S Santhosh
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

| |
| |



C extends A and C extends B, where A and B are different entities. Then C has multiple inheritance.

Sreeds
[ March 25, 2005: Message edited by: San Sreeds ]
 
Kaustubh Patil
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
poor kitty !!!

Sorry.. guys.. couldn't help but add a little humor.
 
Marcus Green
arch rival
Rancher
Posts: 2813
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have about 70 books on my shelf on the Java programming language (a bit excessive I know) starting with one published around 1997 and they all say Java does not support Multiple Inheritance. Now they might all be wrong but...
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java supports only interface inheritance.
You may inherit zero or more interfaces, which have only abstract (no impl) methods.
Java does not support multiple concrete inheritance.
A Java class has one and only one superclass, not zero, not two.
The only exception to this rule is for java.lang.Object, which has zero superclasses.
A Java class inherits from java.lang.Object, directly or indirectly, through concrete inheritance. Each leaf node of the tree has one and only one parent.

Frankly, I don't understand why:
a) this trivial concept is so difficult to grasp
b) this concept continues to be the focus of discussion even after the language has matured
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic