Return to site

What is a default method?

August 4, 2025

๐Ÿš€ Java Interview Questions โ€“ Episode 2
๐Ÿ’ก What is a default method?


๐Ÿ†• Introduced in Java 8, default methods (aka extension methods) allow you to add method implementations directly inside interfaces!

Why is this powerful?
๐ŸŸฃ It lets you add new functionality to interfaces without breaking existing implementations.
๐ŸŸฃ It enabled features like Lambda expressions and the Stream API to work seamlessly with existing Java interfaces.

๐Ÿ” Youโ€™ll spot them in the Java 8 API on interfaces like Map, Iterator, and more โ€” with built-in logic ready to use