OOP Interview Question

What is the difference between an abstract class and an interface?

Updated 2026-07-10 · Beginner friendly
Quick answer

An abstract class is a partly finished class that can have both regular methods with code and abstract methods without code, and it can hold state through fields. An interface is a pure contract that lists methods a class must provide. A class can extend only one abstract class but can implement many interfaces. Use an abstract class for shared base behaviour and an interface for a capability many unrelated classes can share.

Abstract class: a shared base

An abstract class is meant to be a common parent. It can provide some finished methods and leave others for children to complete. You cannot create an object of an abstract class directly.

abstract class Shape {
    abstract double area();          // no body, children must fill in
    void describe() {                // shared, finished method
        System.out.println("I am a shape");
    }
}

Interface: a pure contract

An interface says what a class must be able to do, without saying how. Many unrelated classes can implement the same interface to promise the same capability.

interface Drawable {
    void draw();   // any Drawable must provide draw()
}
class Circle implements Drawable {
    public void draw() { System.out.println("circle"); }
}

Quick comparison

In the interview

A strong line is to say use an abstract class when classes share a common base and some code, and use an interface when unrelated classes need to promise the same capability. Mentioning that a class can implement many interfaces but extend only one class shows you know the practical limit.

Want the full OOP guide?

Read every OOP concept with notes, diagrams, and code in one place. Track your progress as you go.

Open the OOP guide All OOP questions