You can have default methods in a functional interface but its contract requires you to provide one single abstract method (or SAM). Since a default method have an implementation, it's not abstract.

Conceptually, a functional interface has exactly one abstract method. Since default methods have an implementation, they are not abstract.

and

If a type is annotated with this annotation type, compilers are required to generate an error message unless:

The type is an interface type and not an annotation type, enum, or class.

The annotated type satisfies the requirements of a functional interface.

Here you don't satisfy the functional interface's requirement, so you need to provide one abstract method. For example:

@FunctionalInterface
interface MyInterface {

    boolean authorize(int val);
    
    default boolean authorize(String value) {
        return true;
    }
}

Note that if you declare an abstract method overriding one of a public method from the Object's class it doesn't count, because any implementation of this interface will have an implementation of those methods through at least the Object's class. For example:

@FunctionalInterface
interface MyInterface {

    default boolean authorize(String value) {
        return true;
    }

    boolean equals(Object o);
}

does not compile.

Answer from Alex on Stack Overflow
Top answer
1 of 4
54

You can have default methods in a functional interface but its contract requires you to provide one single abstract method (or SAM). Since a default method have an implementation, it's not abstract.

Conceptually, a functional interface has exactly one abstract method. Since default methods have an implementation, they are not abstract.

and

If a type is annotated with this annotation type, compilers are required to generate an error message unless:

The type is an interface type and not an annotation type, enum, or class.

The annotated type satisfies the requirements of a functional interface.

Here you don't satisfy the functional interface's requirement, so you need to provide one abstract method. For example:

@FunctionalInterface
interface MyInterface {

    boolean authorize(int val);
    
    default boolean authorize(String value) {
        return true;
    }
}

Note that if you declare an abstract method overriding one of a public method from the Object's class it doesn't count, because any implementation of this interface will have an implementation of those methods through at least the Object's class. For example:

@FunctionalInterface
interface MyInterface {

    default boolean authorize(String value) {
        return true;
    }

    boolean equals(Object o);
}

does not compile.

2 of 4
13

A functional interface is an interface having a single abstract method. The entire purpose of defining functional interfaces is to enable the implementation of the single abstract method via lambda expressions which will effectively override that method which makes providing a default implementation for it pointless.

Having an interface consisting entirely of default methods raises multiple problems. There is the technical problem that the compiler can’t decide for a lambda expression which method to implement when there are multiple default methods and there is the semantic problem that an interface consisting entirely of default methods is not abstract. You can’t instantiate this default behavior as you can’t instantiate interfaces and are forcing programmers to create concrete classes just to invoke the default behavior, which, since interfaces are stateless, could be provided by a singleton instead:

@FunctionalInterface
public interface MyInterface {
    static MyInterface DEFAULT = s->true;
    boolean authorize(String value);
}

Note that you can have interfaces extending a functional interface and providing a default method, if you need. Still, if this results in creating an interface having no abstract methods I would question the design. You may compare with the discussion about marker interfaces with default methods. If the sub-interface will have different abstract methods than the functional interface, it’s a different story. There might be real use cases for this, but these sub-interfaces will also demonstrate why they shouldn’t be mixed with the functional base interface as a lambda expression will always implement the abstract method.

🌐
Baeldung
baeldung.com › home › java › core java › static and default methods in interfaces in java
Static and Default Methods in Interfaces in Java | Baeldung
May 11, 2024 - Default interface methods are an efficient way to deal with this issue. They allow us to add new methods to an interface that are automatically available in the implementations. Therefore, we don’t need to modify the implementing classes.
Discussions

What is the purpose of default methods in Java Interfaces?
Skimmed trough the article. Way too verbose and it's missing the most important reason for the existence of default methods: Backwards compatability. With default methods the language designers were able to add stream() to collections without breaking every single third party library collection. Everything else was already doable with abstract classes before their introduction. More on reddit.com
🌐 r/programming
11
0
May 28, 2023
Why would you use default methods in interfaces?
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/javahelp
17
5
November 26, 2020
java - why Interface Default methods? - Stack Overflow
Learning java 8 default methods . This link like any other resource on internet says In ‘the strictest sense’, Default methods are a step backwards because they allow you to ‘pollute’ your More on stackoverflow.com
🌐 stackoverflow.com
Since Java interfaces have default methods as of 1.8, does that make abstract classes obsolete?
No, because abstract classes can keep state, which interfaces can't. More on reddit.com
🌐 r/java
14
6
March 5, 2021
🌐
Oracle
docs.oracle.com › javase › tutorial › java › IandI › defaultmethods.html
Default Methods (The Java™ Tutorials > Learning the Java Language > Interfaces and Inheritance)
All method declarations in an interface, including static methods, are implicitly public, so you can omit the public modifier. Default methods enable you to add new functionality to existing interfaces and ensure binary compatibility with code written for older versions of those interfaces.
🌐
GeeksforGeeks
geeksforgeeks.org › java › default-methods-java
Default Methods In Java 8 - GeeksforGeeks
September 6, 2025 - In case both the implemented interfaces contain default methods with same method signature, the implementing class should explicitly specify which default method is to be used or it should override the default method.
🌐
Educative
educative.io › home › courses › java 8 for experienced developers: lambdas, stream api & beyond › default methods in interfaces
Understanding Default Methods in Java 8 Interfaces
However, sometimes methods have ... in each class. In that case, we can declare that method as a default in the interface and provide its implementation in the interface itself....
🌐
Medium
anushasp07.medium.com › java-8-to-17-how-interfaces-have-transformed-over-time-ed4a93771039
Java 8 to 17: A Complete Guide to Default, Static and Sealed Methods | by Anusha SP | Medium
March 16, 2025 - define a method in an interface that multiple implementing classes can use without duplicating code. Instead of using utility classes (e.g., Collections or Arrays classes in Java), default methods allow related functionality to be included directly ...
🌐
Reddit
reddit.com › r/programming › what is the purpose of default methods in java interfaces?
r/programming on Reddit: What is the purpose of default methods in Java Interfaces?
May 28, 2023 - The main feature of the default methods is that the new method can be added to the existing interfaces without forcing all implementing classes to update their code. To create the default methods in an interface, the keyword ‘default’ is specified while defining the method.
Find elsewhere
🌐
DigitalOcean
digitalocean.com › community › tutorials › java-8-interface-changes-static-method-default-method
Java 8 Interface Changes - static method, default method | DigitalOcean
August 3, 2022 - Given the newfound power of interfaces, we should leave them for what they are meant for, to define partial protocols (and implementations) for objects in an object-oriented program, and continue to use classes as a pattern for holding non-OO functionality. is that better than using classes? ... With interface default methods there may also be a scenario where an interface is extending another interface and both of those interfaces have same default method.
🌐
Reddit
reddit.com › r/javahelp › why would you use default methods in interfaces?
r/javahelp on Reddit: Why would you use default methods in interfaces?
November 26, 2020 -

This feature has baffled me since it was released and I've not used it myself. However there is some code where I work which uses it, and I really don't understand why.

Have you ever used default methods in interfaces, and if so, why?

🌐
DEV Community
dev.to › masteringbackend › java-8-features-explained-default-methods-static-methods-and-functional-interfaces-joi
Java 8 Features Explained-Default Methods, Static Methods, and Functional Interfaces - DEV Community
October 1, 2025 - Java 8 solved these problems by introducing functional programming concepts into Java, while still keeping backward compatibility. ... Before Java 8, interfaces could only contain abstract methods (methods without a body). But from Java 8 onwards, interfaces can also have default and static methods.
🌐
Tutorialspoint
tutorialspoint.com › java › java_default_methods.htm
Java - Default Methods in Interfaces
For example, List or Collection interfaces do not have 'forEach' method declaration. Thus, adding such method will simply break the collection framework implementations. Java 8 introduces default method so that List/Collection interface can have a default implementation of forEach method, and the class implementing these interfaces need not implement the same.
🌐
Medium
medium.com › @JavaFusion › functional-interface-in-java-3d73bf980e80
Functional interface in java. A functional interface in Java is an… | by Java Fusion | Medium
April 2, 2024 - MyFunctionalInterface is a functional interface marked with @FunctionalInterface. ... defaultMethod is a default method with a default implementation provided within the interface.
Top answer
1 of 4
20

Before Java 8, interfaces could have only abstract methods. The implementation of these methods has to be provided in a separate class. So, if a new method is to be added in an interface then its implementation code has to be provided in the class implementing the same interface.

To overcome this issue, Java 8 has introduced the concept of default methods which allow the interfaces to have methods with implementation without affecting the classes that implement the interface.

The default methods were introduced to provide backward comparability so that existing interfaces can use the lambda expressions without implementing the methods in the implementation class. Default methods are also known as defender methods or virtual extension methods.

2 of 4
14

To overcome that we could have had one class providing implementation of these default methods and then implementing class like arraylist etc could have extended that.

Your suggestion would work only for standard JDK classes (since they usually extends some base classes such as AbstractCollection and AbstractList, were the implementation of the new methods can be added).

What about custom classes that implement JDK interfaces? If, for example, you have a class that implements List but doesn't extend some JDK List implementation, you should be able to switch to Java 8 without having to implement new methods in your class.

With default implementations of new methods in the List interface, you don't have to touch your custom class. You can later add a custom implementation to those methods if you are not satisfied by the default implementation.

🌐
JavaDZone
javadzone.com › default-methods-in-interfaces-in-java-8-examples
Default Methods in Interfaces in Java 8 Examples - JavaDZone
June 26, 2024 - Conflict Resolution: Requires explicit resolution of conflicting default methods from multiple interfaces. Functional Interfaces: Can have default methods alongside a single abstract method, enhancing their utility in functional programming.
🌐
Mike my bytes
mikemybytes.com › 2021 › 08 › 05 › no-need-to-hate-java-default-methods
No need to hate Java default methods | Mike my bytes
August 5, 2021 - What’s really unfortunate, the ... methods enable you to add new functionality to the interfaces of your libraries and ensure binary compatibility with code written for older versions of those interfaces....
🌐
HowToDoInJava
howtodoinjava.com › home › java 8 › java default methods tutorial
Java Default Methods Tutorial
December 26, 2020 - Any incompatible change in core classes will back fire for sure and will not be accepted at all. Default methods break this deadlock and allow adding support for functional interface in core classes.
🌐
GeeksforGeeks
geeksforgeeks.org › functional-interfaces-java
Java Functional Interfaces | GeeksforGeeks
December 27, 2024 - A functional interface in Java is an interface that contains only one abstract method. Functional interfaces can have multiple default or static methods, but only one abstract method.
🌐
Scaler
scaler.com › home › topics › default method in java
Default Methods In Java 8 - Scaler Topics
May 5, 2024 - ... Default methods allow for adding new functionality to existing interfaces while ensuring binary compatibility with code written for previous versions of those interfaces, as the class implementing these interfaces doesn't have to define ...
🌐
Jenkov
jenkov.com › tutorials › java-functional-programming › functional-interfaces.html
Java Functional Interfaces
March 8, 2021 - The Function interface actually contains a few extra methods in addition to the methods listed above, but since they all come with a default implementation, you do not have to implement these extra methods.
🌐
Geekster
geekster.in › home › functional interface in java
Functional Interface in Java - Geekster Article
July 2, 2024 - Default methods can be directly used in a class implementing the interface as well as can be overridden and redefined. Static methods are required to be called using the name of the interface preceding the method name.