Interface vs Abstract Class in Java — When to Use Each
An interface defines a contract any class can implement; an abstract class provides shared state and partial implementation for related subclasses.
Published September 22, 2026
Use an interface to define a capability that unrelated classes can share, and an abstract class when related classes share state and partial implementation. A class can implement many interfaces but extend only one class.
The concept
Interfaces declare behaviour (methods) and, since Java 8, can include default and static methods. They have no instance state.
Abstract classes can hold fields, constructors and concrete methods, and leave some methods abstract for subclasses to implement.
Quick comparison
interface abstract class
multiple yes no (one parent)
instance fields no yes
constructors no yes
models can-do is-a
Practical examples
Interface: a capability
interface Payable { double amount(); default String label() { return "Pay " + amount(); } }Abstract class: shared base
abstract class Employee {
protected final String name;
Employee(String name) { this.name = name; }
abstract double pay();
String describe() { return name + " earns " + pay(); }
}Both together
class Manager extends Employee implements Payable {
Manager(String n) { super(n); }
double pay() { return 9000; }
public double amount() { return pay(); }
}Common mistakes
- Using an abstract class when no shared state exists, blocking other inheritance.
- Putting too many methods in one interface.
- Forgetting default-method diamond conflicts need explicit resolution.
Key takeaways
- Interface = contract, abstract class = partial base.
- Implement many interfaces, extend one class.
- Prefer interfaces for flexibility.
FAQ
Can interfaces have fields?
Only public static final constants.
Sealed interfaces?
Java 17 sealed types limit which classes may implement them.