3
我有一个接口和抽象类。调用超类中覆盖的默认接口方法
public class TEST extends Abstract implements Inter2{
void print() {
toDO();
}
public static void main(String[] args) {
new TEST().toDO();
}
}
abstract class Abstract {
public void toDO() {
System.out.println("Abstract is called");
}
}
interface Inter2 {
default void toDO() {
System.out.println("Inter2 is called");
}
}
我想强制类接口的默认方法,而不是抽象类。
那么你不能。 – Kayaman
http://stackoverflow.com/a/32478021/2775450 – Codebender