+ 1

Why Java do not support multiple inheritance

Why Java do not support multiple inheritance? and what are the ways to do.

17th Sep 2017, 4:17 PM
Suyog Naikwade
Suyog Naikwade - avatar
2 odpowiedzi
+ 10
Ways to do: interfaces. Why is doesn't: naming reasons, meaning uniqueness of methods ;)
17th Sep 2017, 4:23 PM
Tashi N
Tashi N - avatar
+ 5
\\Java doesn't support multiple inheritance Class A { public void B() { } } Class C { public void B() { } } Class D extends A,C { \\now class D don't know from which class it has to call the method B(). because both extended classes have same method B(). \\This creates ambiguity. } To support multiple inheritance Java uses concept of interfaces and many more. Hope this will clear your doubt.
17th Sep 2017, 4:27 PM
kanishk goel
kanishk goel - avatar