0

Can we say that multiple inheritance in Java is made possible by implementing interfaces?

1

5 Answers 5

4

With default methods in interfaces in java8 we will have multiple inheritance :)

Sign up to request clarification or add additional context in comments.

Comments

2

No. An interface defines how an implementation should communicate with the outside world you do not define any behavior. You can of course implement multiple interfaces but that doesn't mean that you have multiple inheritance, just that the class implementing the interfaces can appear as different things.

Comments

2

No. You aren't really inheriting anything. You are specifying behavior.

Comments

2

It's not really "multiple-inheritance", you are simply outlining what the class should be able to do.

About as close a "multiple-inheritance" goes I suppose would be interfaces extending interfaces, really.

Comments

1

Nope. When you implement an interface, you are simply making a "promise" to implement certain methods in said class. When you extend another class, you inherit its methods and instance variables. Two completely separate things.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.