Java 8 – Functional Interface vs Abstract class

functional-interfacejava

I was exploring features of Java 8 and came across "Functional Interface".

As per my understanding, these interfaces can have some default implemented methods as :

@FunctionalInterface
public interface ComplexFunctionalInterface extends SimpleFuncInterface 
{
    default public void doSomeWork()
    {
        System.out.println("Doing some work in interface impl...");
    }
    default public void doSomeOtherWork()
    {
        System.out.println("Doing some other work in interface impl...");
    }
}

But my doubt is, this what abstract class is for.

Why introduce functional interfaces.

Best Answer

But my doubt is, this what abstract class is for.

Why introduce functional interfaces.

Number of classes that can be extended: 1

Number of interfaces that can be implemented: more than 1