Difference between Abstract class and Interface.
Difference between Abstract Class and Interface are as follows:
Abstract Class:
- Abstract classes have a default constructor and it is called whenever the concrete subclass is instantiated.
- Contains Abstract methods as well as Non-Abstract methods.
- The class which extends the Abstract class shouldn’t require implementing all the methods, only Abstract methods need to be implemented in the concrete sub-class.
- Abstract Class contains instance variables.
Interface:
- Doesn’t have any constructor and couldn’t be instantiated.
- Abstract method alone should be declared.
- Classes which implement the interface should provide the implementation for all the methods.
- The interface contains only constants.