Why is an Interface be able to extend more than one Interface but a Class can't extend more than one Class?

Asked 21-Dec-2017
Viewed 1771 times

1

Why is an Interface be able to extend more than one Interface but a Class can't extend more than one Class?    


1 Answer


0

The interface is a pure abstraction model and does not have inheritance hierarchy like classes that's why interface be able to extend more than one interface but a class can't extend more than one class because Java doesn't allow multiple inheritance, so the class is restricted to extend only one class.
One of the significant difference between interface and classes is that interfaces having no fields but classes can have.
The class can be instantiated which made objects but you can't do with interfaces. One of the reasons that's why the Java programming language doesn't allow you to extend more than one class is to avoid the issues of multiple inheritances of state. Multiple inheritance having ability to inherit fields from multiple classes.

I hope it's informative for you...

Loading...
Ads