In simple terms, I would like to say:
interface: To implement a contract by multiple unrelated objects
abstract class: To implement the same or different behaviour among multiple related objects
From the Oracle documentation
Consider using abstract classes if :
- You want to share code among several closely related classes.
- You expect that classes that extend your abstract class have many common methods or fields, or require access modifiers other than public (such as protected and private).
- You want to declare non-static or non-final fields.
Consider using interfaces if :
- You expect that unrelated classes would implement your interface. For example,many unrelated objects can implement
- You want to specify the behaviour of a particular data type, but not concerned about who implements its behaviour.
- You want to take advantage of multiple inheritance of type.
abstract class establishes “is a” relation with concrete classes. interface provides “has a” capability for classes.
If you are looking for
Java as programming language, here are a few more updates:
Java 8 has reduced the gap between
abstract classes to some extent by providing a
default method feature. An interface does not have an implementation for a method is no longer valid now.