The abstract modifier is applicable for:
- classes
- methods
The abstract modifier is to extend your class or method. This is close to what an interface does, therefore the differences here. Because an interface is on a class level we only compare the abstract class. The 5 differences:
Abstract Class can: | Interface can: | |
1 | only extend one class | extend any number of interfaces at a time |
2 | extend another class | only extend another interface |
3 | have both abstract and concrete methods | have only abstract methods |
4 | have protected and public abstract methods | have only public abstract methods |
5 | have static, final or static final variable with any access modifiers | only have public static final (constant) variable |