An interface is considered a functional interface if it has one abstract method. If an interface extends another interface, how does this affect its status as a functional interface?

Java interview question for Advanced practice.

Answer

It is a functional interface if the combined total of abstract methods from the parent and child interfaces is exactly one.

Explanation

Option B is correct. An interface inherits the abstract methods of its superinterfaces. For an interface to be considered functional, the total count of all abstract methods it defines and inherits must be exactly one. For example, if interface B extends interface A, and A already has one abstract method, B cannot introduce any new abstract methods and still be a functional interface.

Related Questions