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 |
Abstract class keyword "abstract" is mandatory to declare a method as an abstract | Interface keyword "abstract" is optional to declare a method as an abstract |
It can have protected and public abstract methods | Interface can have only have public abstract methods |
Abstract class can have static, final or static final variable with any access specifier | Interface can only have public static final (constant) variable |
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions