• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt in Multiple inheritance  RSS feed

 
Vinayagam moorthy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do Java supports multiple inheritance?If no,clear my doubt

Class A //implicitly extends Object class - implies single inheritance
{
....
...
...
}
Class B extends A //implicitly extends Object class as well as extends Class A
{
..
..
..
}
What Class B is doing?Is it multiple inheritance or not?If not,give me a clear view of the concept behind single inheritance in java..

Thanks in advance
Vina
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, Java does not support multiple inheritance.

Multiple inheritace means inheriting more than one class at the same level. In your example, class B inherits from class A and from Object, but not at the same level - class Object is one level deeper in the class hierarchy.
 
Karthik Krishnamurthy
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To Just extend( ) Jesper's comment, B is inheriting from Object indirectly through A (assuming A is not extending anything else)
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Said another way, a class can only have one direct parent, but it may have many ancestors.

-Cameron McKenzie
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!