| 
 
| interface Inter {
 public static final int x=4;
 void method();
 }
 class Test
 {
 int x=3;
 Inter function()
 {
 int x=5;//就是访问这个外部类的局部变量
 
 return new Inter()
 
 {
 public void method()
 {
 System.out.println("Inner method"+Test.this.x);
 System.out.println("Inner method"+this.x);
 }
 };
 }
 
 }
 
 
 class InnerClassTest
 {
 public static void main(String[] args)
 {
 new Test().function().method();
 }
 
 }
 
 | 
 |