Nisha
Nisha

Reputation: 15

Why is it said interface support multiple inheritance when the interface is completely abstract?

I mean we are actually not inheriting anything from the interface. It is in the concrete class that we define what the methods are suppose to do.

Upvotes: 0

Views: 51

Answers (1)

fge
fge

Reputation: 121720

Interfaces do allow multiple "inheritance" of behavior. What Java does not support is multiple inheritance of state. An interface does not have state.

You can implement one or more interfaces (implement multiple behaviors) but only extend one class, abstract or not (inherit your state from one other class).

Therefore it could be say that Java has "limited" support for multiple inheritance, but it's not multiple inheritance as it is canonically defined.

Upvotes: 1

Related Questions