Multiple Inheritance is not supported in Java
Below diagram explains is called Diamond Problem because of the inheritance structure.
A foo()
/ \
/ \
foo() B C foo()
\ /
\ /
D foo()
Multiple inheritance does cause casting, constructor chaining,etc problems.
Also, multiple inheritance leads to complexity.
Hence, Java do not support multiple inheritance.
But recently, in JAVA 8, this problem is handled in different way, that is, the compiler will throw exception in this scenario and we will have to provide implementation logic in the class implementing the interfaces.
A foo()
/ \
/ \
foo() B C foo()
\ /
\ /
D foo()
Multiple inheritance does cause casting, constructor chaining,etc problems.
Also, multiple inheritance leads to complexity.
Hence, Java do not support multiple inheritance.
But recently, in JAVA 8, this problem is handled in different way, that is, the compiler will throw exception in this scenario and we will have to provide implementation logic in the class implementing the interfaces.
Comments
Post a Comment