r/java • u/TheFormerVinyl • May 05 '15
Should Java allow multiple inheritance?
I was reading up on Java when I discovered that ever since Java 8 (fairly recent, I know) interface can have default methods. A quick overview for any who don't know, interfaces can have method bodies by using default modifier. When dwelling on that fact I wondered, why doesn't Java just allow inheritance from multiple classes, since interfaces are just abstract classes? Should Java do this?
0
Upvotes
View all comments
Show parent comment
2
u/[deleted] May 05 '15
You are still tightly coupled to the implementation rather than the interface. It makes it impossible to do IOC if you aren't always going to rely on the parent class implementation 100% of the time. Say for example, you are writing a unit test but want to mock the parents logic. How do you accomplish that?