
Java doesn't support multiple inheritance because of Deadly Diamond of Death
Lets take an example:
1)Please take a notebook and a pencil, and start making a diagram
2)Suppose we have one class A, with a method printMe().
3) We have two subclass B and C, both inherits A and both Override printMe()
A
B C
Please connect B,and C to A by arrow.
4) Now Lets suppose we have one more class D, Now if Java supports multiple inheritance then we can write
class D inherits B,C
which means following :
A
B C
D
Please connect D to both B and C by arrow.
Now if we look at the image, it actually a close structure with a "diamond kind of shape", along with this there is a big problem- {Please look at the image.}