answersLogoWhite

0

compiler will confuse when two super class has same method name.

The above is correct, and it's a DESIGN decision made by the originator of Java, James Gosling. That is, Gosling recognized that true Multiple Inheritance has a certain amount of ambiguity involved, and mistakes around that ambiguity are easy to make and hard to detect. So, Gosling decided that Java should not allow Multiple Inheritance at all. Almost all of the functionality of class-based Multiple Inheritance can be obtained via Interfaces. Additionally, not supporting Multiple Inheritance greatly simplifies the compiler requirements, and makes the JVM faster and easier to create.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

What is single inheritance in c plus plus?

Multiple inheritance occurs when a class is derived directly from two or more base classes. class b1 {}; class b2 {}; class d: public b1, public b2 {}; // multiple inheritance class


Give the structure of multiple inheritance?

Java does not support multiple inheritance. It is done with the help of interfaces in java. a class can implement n number of interfaces, thus showing multiple inheritance. but a class cannot extend multiple classes in java.


What is the Difference between multilevel and multiple inheritance?

Multiple Inheritance : we can inherit more than one class in the same class. Multi-Level Inheritance: where one class can inherit only one base class and the derived class can become base class of some other class.


What is the Difference between multiple inheritance and multilevel inheritance in asp.net?

Multiple inheritance, as the name 'multiple' suggests, is one where more than one(multiple) super class is inherited by one sub-class. It can be represented as:A B C\ | /DOn the other hand, in case of multilevel inheritance; the superclass is inherited by a sub-class which is in turn inherited by another class leading to the different level. It can be represented as:A|B|CHowever in asp, multiple inheritance is not supported.


How you possible multiple inheritance in java?

Actually, java does not support multiple inheritance. You can achieve partial multiple inheritance using interfaces but java is not like C or C++ where you can do direct multiple inheritance. However, you can achieve partial multiple inheritance with the help of interfaces. Ex: public class FerrariF12011 extends Ferrari implements Car, Automobile {…} And this is under the assumption that Car and Automobile are interfaces. Here if you see, though you don't inherit concrete code from the Car or the Automobile interface, you do inherit skeleton methods that determine the way your class eventually behaves and hence this can be considered partial Multiple Inheritance


How multiple inheritance is done in java?

Java doesn't have multiple inheritance proper. It is possible for a class to implement different interfaces - however, in this case, only the method names are "inherited", not their contents. It is also possible to use composition instead of inheritance: an object can contain objects of different classes, and use the methods of the objects it contains - but this, too, is a different mechanism than inheritance.


Specification forms of inheritance in java?

single level inheritance eg ( class B extends Class A) Multilevel inheritance eg( class C extends class B and class B extends class A) multiple inheritance Class C inherits Class A features as well as Class B featues.This type of inheritance is not allowed in JAVA.


What kind of inheritance is not allowed in java?

Java does not allow the multiple inheritance of concrete classes, though it does allow a "hybrid" inheritance of one concrete class and multiple interfaces.


What is the Definition of multiple inheritance?

Direct Multiple Inheritance in Object Oriented terms is the feature where one class extends/inherits the features of multiple classes. ex: Assuming there is a class A which has method a() and class B which has method b() - Now if we need a class C that needs the features of both A and B it could be like: public class C extends A, B { ... } This way it can use both the methods a() and b(). Unfortunately Java does not support direct multiple inheritance. You can achieve partial multiple inheritance using interfaces.


Can you use multiple inheritance in .NET?

Multiple inheritance in C# In C#, the classes are only allowed to inherit from a single parent class, which is called single inheritance. But you can use interfaces or a combination of one class and interface(s), where interface(s) should be followed by class name in the signature.


Multiple inheritance in java?

Actually, java does not support multiple inheritance. You can achieve partial multiple inheritance using interfaces but java is not like C or C++ where you can do direct multiple inheritance. However, you can achieve partial multiple inheritance with the help of interfaces. Ex: public class FerrariF12011 extends Ferrari implements Car, Automobile {


How can you write multiple inheritance program in java?

Java does not support direct multiple inheritance. You can implement partial multiple inheritance using interfaces. ex: public class ExMultInherit implements interface1, interface2, interface 3 { ... .... ...... }