WEBVTT

00:00.230 --> 00:00.740
Hi everyone.

00:00.740 --> 00:01.940
Welcome back to this tutorial.

00:01.940 --> 00:06.650
In this tutorial we will discuss about the definition of effectively final.

00:06.650 --> 00:13.250
As we have seen in the previous tutorial, it is not allowed to reassign or modify the value of the

00:13.250 --> 00:16.010
local variable inside the lambda expression.

00:16.280 --> 00:24.250
We did not make the variable final, but still inside the lambda body it is treated like a final variable.

00:24.260 --> 00:28.390
This concept is called effectively final.

00:28.400 --> 00:30.790
I have provided the same example here.

00:30.800 --> 00:34.620
Here we have a local variable called int value equal to four.

00:34.640 --> 00:40.640
If you try to change a value here by reassigning it, this will give you the compilation issue.

00:40.670 --> 00:45.640
This concept is called effectively final until Java seven.

00:45.650 --> 00:52.640
If you want to use the variable inside the anonymous class, which is nothing but the implementation

00:52.640 --> 00:57.590
of the functional interface, you have to declare the variable with the final keyword.

00:57.620 --> 01:01.290
Basically, with this change, it saves a keystroke.

01:02.150 --> 01:09.170
What are the advantages of effectively final having the local variables declared as effectively?

01:09.200 --> 01:15.120
Final is going to make the life of the developers easy for building the concurrency applications.

01:15.140 --> 01:22.790
One Another advantage is that this will promote the functional style programming and demotes the imperative

01:22.790 --> 01:24.080
style programming.

01:24.110 --> 01:26.390
With this, we came to the end of this tutorial.

01:26.420 --> 01:27.620
Thank you for watching.
