Why multiple inheritance is not supported in java?

Mitali sahuMitali sahu
1 min read

What is multiple inheritance ?

So whenever the child class inherits the properties from the multiple parent class then it is called as multiple inheritance.

Why it is not supported?

Let suppose java supports multiple inheritance, so the subclass inherits the properties from the multiple super classes but in java every class must contain at least one constructor either compiler generated or programmer generated so every constructor has super() which call the parent class constructor so whenever the subclass constructor call the super class constructor then JVM get ambiguity that form which parent class it can access the properties. That’s why java does not support multiple inheritance in java but it can be possible through interface concept. and it is also known as Dimond ambiguity problem.

0
Subscribe to my newsletter

Read articles from Mitali sahu directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Mitali sahu
Mitali sahu