Skip to content
UniCircle
MediumConceptualAbstraction

Abstract class vs interface

Question JAVA-ABS-016

Compare abstract classes and interfaces in modern Java (8+). When would you choose each?

Show the explanation
Abstract classInterface
Inheritancea class extends onea class implements many
Stateinstance fields of any kindonly public static final constants
Constructorsyes (run by subclasses via super)no
Methodsabstract and concrete, any accessabstract, default, static, private (Java 9+)
Relationship"is a kind of" with shared code"can do" — a capability or contract
Java
interface Payable { double amountDue(); }                  // capability
abstract class Employee implements Payable {
    protected final String name;                           // shared state
    Employee(String name) { this.name = name; }
    public abstract double monthlyPay();
    public double amountDue() { return monthlyPay(); }     // shared behaviour
}
class Intern extends Employee {
    Intern(String n) { super(n); }
    public double monthlyPay() { return 15000; }
}

Choose an interface to define a contract that unrelated classes can share (and to allow multiple inheritance of type). Choose an abstract class when closely related classes share state or a common partial implementation. A common design is both: an interface for the contract and an abstract class as a convenient base.

Original UniCircle question. Last reviewed 22 Oct 2026.