直接用英文逗号分隔就可以了,比如:
inerface IHello {
String sayHello(String name);
}
interface IHi {
String sayHi(String name);
}
class ServiceImpl implements IHello, IHi {// 实现三个四个。。。n个接口都是使用逗号分隔
public String sayHello(String name) {
return “Hello, ” + name;
}
public String sayHi(String name) {
return “Hi, ” + name;
}
}
补充知识:Java 一个类实现的多个接口,有相同签名的default方法会怎么办?
看代码吧~
public interface A {
default void hello() {
System.out.println(“Hello from A”);
}
}
public interface B extends A {
default void hello() {
System.out.println(“Hello from B”);
}
}
public class C implements B, A {
p