0 votes
1 view
in Java by (10.2k points)
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 that when I use variables inside anonymous class they must be final in outer class, but still - what is the difference between final and effectively final?

1 Answer

0 votes
by (46.1k points)

I obtain the easiest way to describe "effectively final" is to assume adding the final modifier to a variable declaration. If with this addition, the program continues to run in the same way, both at compile time and at run time, then that variable is effectively last.

Here is the doc for your reference. 

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...