Referencing non-final variable: why does this code compile?

前端 未结 4 1326
被撕碎了的回忆
被撕碎了的回忆 2021-02-12 03:39

First off, I apologise if this is a duplicate question. I found many similar ones, but none that directly address my question.

In preparation for an upcoming exam, I am

4条回答
  •  余生分开走
    2021-02-12 03:54

    It may work in Java8 as the stress is on Effectively Final which means once the value is assigned to jtf it should not be changed after wards. As per Java doc:

    A variable or parameter whose value is never changed after it is initialized is effectively final.

提交回复
热议问题