why java does not support multiple inheritance
Answer Posted / mahesh patil
Suppose consider a method aaa() which is in class Z.
Suppose a programmer ABC inherited the class Z to class X
and overrided the aaa().So this class will have the new
implementation of aaa().
Suppose a programmer DEF inherited the class Z to class Y
and overrided the aaa().So this class will have the new
implementation of aaa().
If Multiple Inheritance is permitted in java, then if the
new programmer inherited both the classes and he didn't done
any overriding of method aaa() then if he calls the aaa()
,the JVM will not know which method to call i.e., either the
method in class X or method in class Y.
Because of this inconsistencies,Multiple inheritance is not
permitted in java.
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Can arraylist hold different types java?
What is instance synchronization?
Why are pointers not secure?
What’s a deadlock?
Why we override equals() method?
Explain the difference between treeset and treemap in java?
What is a string token?
What is thread life cycle in java?
If we allocate the memory using 'new' & de-allocated using 'free' then what will happen?
Can private class be extended java?
How do you calculate square roots?
How to convert string to char and vice versa?
How many types of classes are there in java?
Why do we use predicate in java?
Can a singleton class be inherited?