Programming

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

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

Abstract class

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.

Last reviewed: September 2026