不一定,它也可以这样的
举个例子你就没白了
class ClassA {
public interface interface1 {
void Test();
}
public static interface interface2 {
void Test2();
}
};
class ClassInteface1 implements ClassA.interface1 {
public void Test() {
System.out.print("My name is interfaceOne");
}
}
class Classinteface2 implements ClassA.interface2 {
public void Test2() {
System.out.print("My name is interface2");
}
}
public class MainTest {
public static void main(String[] args) {
ClassA.interface1 one= new Classinterface1();
one.Test();
ClassA.interface2 two = new Classinterface2();
two.Test2();
}
}
注意:无论接口有没有Static, 都可以正常被实现.这也是内部接口的实现啊 |