Why does java doesnot support multiple inheritance?
Answer Posted / rana.ankur
Suppose consider a method funX() which is in class Z.
Suppose a programmer A inherited the class Z to class X and
overrided the funX().So this class will have the new
implementation of funX(). ie class X extend Z
Suppose a programmer D inherited the class Z to class Y and
overrided the funX().So this class will have the new
implementation of funX(). ie class Y extend Z
If Multiple Inheritance is permitted in java, then if the
new programmer C inherited both the classes and he didn't
done any overriding of method funX() then if he calls the
funX() ,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 ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is immutability in java?
Where are the card layouts used?
What is arraylist class in java?
4.1 Supply contracts (in the form of comments specifying pre- and post conditions) for the enqueue() method of the LinkedQueue class given in the Appendix. (2) 4.2 Let Thing be a class which is capable of cloning objects, and consider the code fragment: Thing thing1 = new Thing(); //(1) Thing thing2 = thing1; //(2) Thing thing3 = (Thing) thing1.clone(); //(3) Explain how the objects thing2 and thing3 differ from each other after execution of the statements. (
What is == in java?
Explain about the select method with an example?
What is the purpose of file class?
What is a loop java?
Which is better stringbuffer or stringbuilder?
How many bytes is a char in java?
What happens to a static var that is defined within a method of a class?
Can we extend singleton class in java?
What are the four corner stones of oop?
I want to re-reach and use an object once it has been garbage collected. Define how it’s possible?
What does java edition mean?