Can you explain why Java 8 introduced the concept of Default Methods in interfaces, and what problem does it solve?

Java 8 introduced default methods so that interfaces could gain new methods with a built-in implementation, letting the standard library evolve — most notably by adding Stream support to the Collections Framework — without forcing every existing implementing class to be recompiled or modified.

Key Points

Example

The Iterable interface gained a default forEach() method in Java 8; every pre-existing class that implemented Iterable, going back years, automatically supported the new forEach() call without any code changes.

Interview Tip

A concise interview answer is

Default methods solve the interface-evolution problem: before Java 8, adding a method to an interface broke every implementing class. By giving the new method a default body, Java could add things like stream() and forEach() to Collection and Iterable without breaking backward compatibility. When two default methods conflict across interfaces, Java forces the implementing class to resolve it explicitly rather than silently picking one.

Last updated: 16 July 2026

Previous question: How can you apply a custom comparator in a stream pipeline in Java 8?

Next question: Can you use this and super in a lambda expression? Why or why not?

More Java 8 interview questions

All Java 8 questions