jdk8新特性

160 阅读1分钟

接口可以有具体的实现方法 default、static

接口中方法使用的注意事项 非default、static方法不能有实现,否则编译错误:Abstract methods do not specify a body

default、static方法必须有具体的实现,否则编译错误:This method requires a body instead of a semicolon

可以拥有多个default方法

可以拥有多个static方法

可以实现抽象类的功能