effectively final
A variable or parameter whose value is never changed after it is initialized is effectively final.
public class Test01 {
public static void main(String[] args) {
int i = 12;
new Test01().method(i);
}
public void method(int locvar){
C cc = new C() {
@Override
public void method() {
System.out.println(locvar);
}
};
cc.method();
}
}
interface C {
void method() ;
}
参考文章
http://stackoverflow.com/questions/20938095/difference-between-final-and-effectively-final