+ 9

How to implement multiple inheritance in Java?

7th May 2017, 6:31 AM
JULIUS FREDRICK
JULIUS FREDRICK - avatar
4 odpowiedzi
+ 20
Java doesn't supports multiple inheritance of classes due to the following reasons: http://www.geeksforgeeks.org/java-and-multiple-inheritance/ P.S. You can still use interfaces.
7th May 2017, 6:35 AM
Dev
Dev - avatar
+ 6
Java doesn't currently support multiple inheritance. This was a design decision at the time, not a defect. The decision was taken to avoid potential ambiguities and complexity that C++ presented to support multiple inheritance, Google the "dreaded diamond". Java 8 adds default and static methods to interfaces which have traditionally been Java's answer to multiple inheritance. These bring it closer to C++ multiple inheritance, probably a good thing although I've yet to encounter it much in the wild.
7th May 2017, 6:45 AM
Leon
Leon - avatar
+ 3
you can implement more than one interface, however it is not exactly the same as inheriting. You can only inherit from one class
7th May 2017, 6:33 AM
Martin Soukup
Martin Soukup - avatar
+ 3
by using interface
7th May 2017, 6:41 AM
Mayur Chaudhari
Mayur Chaudhari - avatar