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

1 votes
205 views
Sophia Morrow asked 21-Dec-2017 in Technology by Sophia Morrow

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 votes
Harsh kumar srivastava answered 21-Dec-2017 by Harsh kumar srivastava
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...