[code="java"]
public class Test1 {
interface Interface{int f1() ;}
Interface f(final int i){
return new Interface(){public int f1(){return i;}};
}
public static void main(String[] args){
Interface h=new Test1().f(6);
System.out.println(h.f1());
}
}
[/code]
按理来说,当f()被调用过之后i的生命周期随之结束,那匿名类如何保持下i的信息?