|
Answer» The following table lists the differences between an interface and abstract class: | Interface | Abstract class |
|---|
| Only abstract methods are allowed in an interface. It can also contain default and static methods with Java 8. | There are abstract and non-abstract methods in an abstract class. | | We cannot implement the concept of multiple INHERITANCES USING interfaces. | We cannot implement the concept of multiple inheritances using abstract classes. | | The implementation of an abstract class cannot be provided by an interface. | An abstract class can provide interface implementation. | | Only static and final variables are used in the interface. | Variables in an abstract class can be final, non-final, static, or non-static. | | To declare an interface, we use the interface keyword. | To declare an abstract class, we use the abstract keyword. | | Only another Java interface can be extended by an interface. | An abstract class can implement numerous Java interfaces by EXTENDING another Java class. | | The keyword "IMPLEMENTS" can be used to create an interface. | The keyword "extends" can be used to extend an abstract class. | | By default, MEMBERS of a Java interface are public. | Private, protected, and other class members can be found in a Java abstract class. |
|