Java 8 – functional interfaces and abstract classes
•
Java
See English answers > java 8: virtual extension methods vs Abstract Class5
According to my understanding, these interfaces can have some default implementation methods:
@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 what I suspect is that this is the purpose of abstract classes
Why introduce functional interfaces
Solution
@H_ 301_ 15@
But my doubt is,this what abstract class is for.
Why introduce functional interfaces.
Number of classes that can be extended: 1
Number of realizable interfaces: more than 1
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码