Difference Between Abstract Class and Interface in Java
Abstract classes and interfaces are the two main building blocks of the Java Programming Language. Though both are primarily used for abstraction, they are very different from each other and cannot be used interchangeably.
| Abstract Class | Interface |
|---|---|
| It can extend only one class or one abstract class at a time. | It can extend any number of interfaces at a time. |
| It can extend another concrete (regular) class or abstract class. | It can only extend another interface. |
| Abstract class have both abstract and concrete methods. | Interface can have only abstract methods. |
| Keyword abstract is mandatory to declare a method as abstract. | Keyword abstract is optional to declare a method as abstract. |
| It can have protected and public abstract methods. | Interface can have only public abstract methods. |
| Can have static, final, or static final variables with any access specifier. | Can only have public static final (constant) variables. |
