Difference between final and effectively final

后端 未结 14 2811
孤独总比滥情好
孤独总比滥情好 2020-11-22 00:38

I\'m playing with lambdas in Java 8 and I came across warning local variables referenced from a lambda expression must be final or effectively final. I know tha

14条回答
  •  孤独总比滥情好
    2020-11-22 01:01

    The Effectively final variable is a local variable that is:

    1. Not defined as final
    2. Assigned to ONLY once.

    While a final variable is a variable that is:

    1. declared with a final keyword.

提交回复
热议问题