Bat*_*tty 6 java functional-interface
我正在探索Java 8的功能,并遇到了"功能接口".
根据我的理解,这些接口可以有一些默认的实现方法:
@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...");
}
}
Run Code Online (Sandbox Code Playgroud)
但我怀疑的是,这是抽象类的用途.
为什么要介绍的功能接口.
| 归档时间: |
|
| 查看次数: |
10840 次 |
| 最近记录: |