Search code examples
javainterfaceabstract-classjava-8default-method

Fundamental difference between interface and abstract class in Java 8


Considering that interfaces now can give an implementation to the methods it provides, I cannot properly rationalize the difference between interfaces and abstract classes. Does anyone know how to explain the difference properly?

I was also told that interfaces are somewhat more light-weight compared to abstract classes, performance wise. Can someone confirm this?


Solution

  • Interfaces still can't have any state. Interfaces still can't have any final method, which means that any implementation can override all its default methods. And interfaces still can't have any constructor.

    You can still implement multiple interfaces, even if they have default methods with the same signature. You can't extend multiple classes (abstract or not).