Why java Don't Support Multiple interitence

Answer Posted / bhaskar reddy

There is a big reason behind that(java does not support
multiple inheritance). Please go through the following
example.

1. Assume that java is supporting multiple inheritance

class A {

void m1() {
// implement method
}
}

class B {
void m1() {
// implement method
}
}
//As for the assumption (1) the following code will compile

class C extends A,B {

public static void main( String s[]) {

C c = new C();
c.m1();
}
}

Note : In main method i am calling c.m1() method In this
situation which super class m1 method has to call (from A
or B) JVM will confuse.

So our assumtion(1) is wrong .

This is the reason why java does not support multple
inheritance through classes.

Note : This same cocept is applicable for classes.

Is This Answer Correct ?    29 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How objects of a class are created if no constructor is defined in the class?

821


What is the point of java?

801


What is the size of int in 64-bit jvm?

800


What are loops in java?

812


Why scanner is used in java?

799


What is the instance of an object?

866


Can interface be private in java?

774


What is the static field modifier?

841


Is string an object?

881


What is the default execution method in java?

879


why using interface interface ?

1785


what is the use of pojo (plain old java objects)? how it is interact with crystal reports? pls urgent

1965


Is array a class?

728


What is the difference between Java Program Constructor and Java Program Method, What is the purpose of Java Program constructor Please Explain it Breafily?

838


What does int [] mean in java?

781