We have mentioned a final property several times in relation to the notion of a constant in Java. But that is only one case of using the final keyword. It can be applied to any variable in general. Also, a similar constraint can be applied to a method and even a class too, thus preventing the method from being overridden and the class being extended.
Final variable, method, and classes
Final variable
The final keyword placed in front of a variable declaration makes this variable immutable after the initialization. For example:
final String s = "abc";
The initialization can even be delayed:
final String s;
s = "abc";
In the case of an object property, this delay can last only until the object is created....