我只是想我可以this在interface.
那么,如果this关键字class在 a 中代表当前对象引用class,那么它在 a中代表什么interface?
interface InterfaceOne {
default void display() {
this.defaultMethod();
System.out.println("InterfaceOne method displayed");
}
default void defaultMethod() {
System.out.println("defaultMethod of InterfaceOne called");
}
}
Run Code Online (Sandbox Code Playgroud)