• Dear Guest, Please do NOT forget to join our JAVA JOBS (ONLY) FACEBOOK GROUP to be aware of latest JAVA openings, and you may also post any JAVA related queries/jobs.

final keyword

Very Good Question Indeed. Surprised to not to see the answer of this.

For this we will take an example of a setter method. Please see the same below:

public void setTest(String test) {
    test = test;
Now suppose i forgot to add the "This" keyword over here. What will happen here is the variable that you are trying to set here will not be set. Now if i Add the final keyword on the parameter. This would give me a compile time error and I will get to know that there is something wrong here. Which helps in understanding. Hope it helps.
The final keyword in java is used to restrict the user. The java final keyword can be used in many context. Final can be:

1. variable
2. method
3. class.