在《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.
其实,需要定义为final的,就是为了防止在调用该变量时,该变量的引用被修改,导致出现无法预料的问题。
|