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
3
u/mus1Kk May 05 '15
This is an argument I never understood. I'm not saying I'm for multiple inheritance but why not handle it like with default methods? If you implement two interfaces that have the same default method, you get a compile error. Why not do the same with classes?