What is the difference between interfaces and abstract classes in Java?



Following are the notable differences between interface and abstract class in Java.

Abstract ClassInterface
An abstract class may contain concrete method.
All the methods of an interface are abstract.
To use an abstract class, you need to inherit it. Provide body to (override) the abstract methods if there are any.
To use an interface you need to implement the interface and provide body to (override) all the abstract methods of it.
Members of an abstract class can be public, private, protected or default.
All the members of the interface are public by default.

Advertisements