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 a programmer confirms that the data submitted has been succesfully inserted into the database(either oracle or my sql).. How a programmer confirm if there is any problem with the program he wrote for insertion... ANS:--- >executeupdate method is having boolean return type, if anything goes wrong in data insertion or data updation, it would return false. otherwise, if it successfully inserts data into the database, it would return true NOW HOW TO I CHECK IN MY DURING EXECUTION WHETHER IT RETURNS TRUE OR FALSE... WELL IT WILL DISPLAY ANY MESSAGE OR NOT

1839


What is skeleton and stub?

585


Realized?

1652


Which is bigger float or double?

514


What is the definition of tree ?

583






Can a class be defined inside an interface?

555


What is prime number in java?

530


What is java argument list?

513


Is string an object?

643


What is the use of a conditional inclusion statement in Java ?

580


Explain public static void main(string args[]) in java.

524


What is the difference between JDK and JVM?

623


What is replacefirst in java?

561


Can we use different return types for methods when overridden?

552


How java uses the string and stringbuffer classes?

507