Short answer
An interface defines a contract of methods a class must implement, with no shared implementation (traditionally), while an abstract class can provide some shared implementation alongside methods that subclasses must complete.
Both are used to define a common structure other classes follow, but they serve different design purposes.
Interface
- A class can implement multiple interfaces (Java doesn't support multiple inheritance of classes, but does allow this for interfaces)
- Traditionally couldn't contain method implementations, though modern Java allows default methods with a body
- Used to define a capability or contract, like Comparable or Runnable
Abstract class
- A class can only extend one abstract class (single inheritance)
- Can contain a mix of fully implemented methods and abstract methods that subclasses must implement
- Used when related classes share meaningful common code, not just a shared contract
A common rule of thumb: use an interface to define what a class can do, and an abstract class when there's actual shared behavior to inherit.