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

前端 未结 4 1339
被撕碎了的回忆
被撕碎了的回忆 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 04:20

    Java 8 added the ability to access "effectively final" variables. The final keyword is no longer required as long as a variable is never changed after it is initialized.

提交回复
热议问题