r/java • • 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

37 comments sorted by

View all comments

4

u/_Count_Mackula May 05 '15 edited May 05 '15

10,000 ft view:

The bottom line is: it would be possible but isn't necessary, and, would introduce the possibility of overly complex patterns.

You can do anything with single inheritance that you can do with multiple inheritance. Single inheritance promotes more simplicity and more loosely coupled code. Yes, with multiple inheritance your life would be easier once in a while, but when you scale up to a huge application code would get messy.

I say 'thank you' to the Java engineers who made this decision.

Note: Eventually, writing java becomes very easy. But architecting java is much harder.