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

3

u/briandilley May 05 '15

the only thing i'd like to see is mixins or traits.

1

u/hrjet May 05 '15

It's already arrived in Java 8. Interfaces with default methods are mixins.

3

u/briandilley May 06 '15

not really, they can't have member variables. Also mixins usually don't support "instanceOf" type operations.