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
when a request is generated from apache tomcat 5.5 and goes to oracle 10g or mysql,,, how the oracle or mysql reads the request as apache is a web server and oracle 10g is application server? when the oracle 10g provides response, how the apche tomcat reads it???
Is java util list serializable?
How big is a pointer?
Explain the JDB in depth & command line.
How to use arraylist in java netbeans?
How we can declare a static variable?
How do you reverse a string in java?
can I implement my own start() method? : Java thread
What is meant by class and object in java?
what is abstract class in Java?
What is java jit compilers?
What is return null in java?
Why can't we override private static methods?
Explain the use of shift operator in java. Can you give some examples?
Can static methods access instance variables in java?