Java8的接口新特性
接口:
public interface Test8Interface {
default String hello(String hello){
hello = "HELLO" + hello;
return sayHi(hello);
}
String sayHi(String hello);
}
实现类A:
public class HelloWorld implements Test8Interface {
@Override
public String sayHi(String hello) {
return hello;
}
}
实现类B:
public class HelloGood implements Test8Interface {
@Override
public String sayHi(String hello) {
return hello;
}
}