Sobes.tech
Junior — Middle

What does the term used to denote a method in a functional interface mean?

sobes.tech AI

Answer from AI

In the Java functional interface, the term used to denote a method is an abstract method. A functional interface is an interface with exactly one abstract method, which can be implemented using a lambda expression or a method reference.

For example, the Runnable interface has a single abstract method run(), making it a functional interface:

@FunctionalInterface
public interface Runnable {
    void run();
}

The @FunctionalInterface annotation is not mandatory but helps the compiler verify that the interface is indeed functional.