作者: 草貌路飞 时间: 2013-7-8 18:56
因为如果不把它开弄成常量,当show方法执行完时a也消失了,但是创建的内部类有可以还没有消失,这样内部类中就引用了一个不存在的值,所以弄成常量,即使方法执行完了这个常量也还是,内部类对象引用它就没有问题作者: likairoudou 时间: 2013-7-8 19:17
在《Core Java 8th Editon》里是这么说的: A local variable that is declared final cannot be modified after it has been initialized. Thus, it is guaranteed that the local variable and the copy that is made inside the local class always have the same value.