What is the exact use of abstract class and interface? Which one is better abstract class or interface?
Java does not support Multiple Inheritance but the multiple inheritance can be achieved by using the interface.
Interfaces are useful when you do not want classes to inherit from unrelated classes just to get the required functionality.
It relate classes from different types of hierarchy.
Any class that extends the abstract class has to provide the implementation to the abstract methods. Hence these classes can be used as a skeleton to similar classes where some common functionality may be required. Such functionality can also be embedded into these classes.
Abstract class prevents from instantiating a class that is supposed to be extended first.
For more information, visit the following links: