Java Interview Question

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

Updated 2026-08-16 · Beginner friendly
Quick answer

An abstract class can have constructors, fields, and both finished and unfinished methods, and a class can extend only one. An interface defines a contract, can have default and static methods since Java 8, cannot hold instance state, and a class can implement many. Use an abstract class for a shared base, and an interface for a capability shared across unrelated classes.

Key takeaways
  • An abstract class can hold state and mix finished and abstract methods, and a class extends only one.
  • An interface is a contract, and a class can implement many interfaces.
  • Since Java 8 interfaces can have default methods, narrowing the old gap between the two.

Key differences

interface Flyer {
    default void takeOff() { System.out.println("lifting off"); }
}
abstract class Bird {
    abstract void sing();
}
In the interview

Mention that Java 8 default methods blurred the line, but the big rule remains: you can implement many interfaces but extend only one class. Use interfaces to model capabilities and abstract classes to share base behaviour.

Frequently asked questions

Can an interface have method bodies now?

Yes. Since Java 8 interfaces can have default and static methods with bodies, and since Java 9 they can have private methods too.

When should you use an abstract class in Java?

Use one when related classes share common fields and some implemented behaviour, and you want a single base type for them.

Want the full Java guide?

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

Open the Java guide All Java questions