class NestInterface{
interface I{
String STR="nest interface member attrib";
void fun();
}
public static void main(String[] args){
System.out.println(NestInterface.I.STR);
//NestInterface.I.fun();
//^==不能使用因fun()尚未定義
C c=new C();
c.fun();
}
}
class C implements NestInterface.I{
public void fun(){
System.out.println( "nest interface member method");
}
}
//===================================
interface NestInterface2{
interface I{
String STR="nest interface member attrib";
void fun();
}
}
class C implements NestInterface2.I{
public void fun(){
System.out.println( "nest interface member method");
}
public static void main(String[] args){
System.out.println(NestInterface2.I.STR);
C c=new C();
c.fun();
}
}
沒有留言:
張貼留言