interface Inter{
void show();
}
class Outer{
public static Inter menthod(){
return new Inter(){
public void show(){
new Inter(){
public void show(){
new Inter(){
public void show(){
new Inter(){
public void show(){
System.out.println("helloWorld1");
}
}.show();
System.out.println("helloWorld2");
}
}.show();
System.out.println("helloWorld3");
}
}.show();
System.out.println("helloWorld");
}
};
}
}
class Test{
public static void main(String[] args){
Outer.menthod().show();
}
}
只是不知道这种写法有没有用途
|
|