File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Multiple Inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Multiple Inheritance" Watch "Multiple Inheritance" New topic
Author

Multiple Inheritance

Bala jee
Ranch Hand

Joined: Sep 22, 2007
Posts: 35
Hi All,

Why java does not support multiple inheritence While C++ Supports the same?
What is the drawback Java will face if it supports Multiple in heritance?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14272
    
  21

Java does support a form of multiple inheritance; a class can implement more than one interface. But in Java you can't extend multiple classes.

You never really need this in real applications, and it leads to problems like the diamond problem. In C++ this is solved by making things more complicated - you can choose between virtual inheritance and non-virtual inheritance in C++.

One of the goals that the designers of the Java language had was to make it simpler than C++, so they decided to not support multiple inheritance in Java.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Originally posted by Jesper Young:
One of the goals that the designers of the Java language had was to make it simpler than C++


That's not exactly a difficult goal to achieve is it?!


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple Inheritance