Abstract Class and Interface in Java
Here’s a table illustrating the differences between an abstract class and an interface:
| Abstract Class | Interface |
|---|---|
| 1) Contains abstract methods, concrete methods, or both | 1) Contains only abstract methods |
| 2) Access specifiers for methods (except private) can vary | 2) Access specifiers for methods must be public |
| 3) Variables can have different access specifiers (except private) | 3) Variables are public, static, and final |
| 4) Does not support multiple inheritance | 4) Supports multiple inheritance through interfaces |
| 5) Implements the interface using the “implements” keyword | 5) Implements the interface using the “implements” keyword |
