Java FAQ

Why would the ‘final’ keyword ever be useful?

final expresses intent. It tells the user of a class, method or variable “This element is not supposed to change, and if you want to change it, you haven’t understood the existing design.”

This is important because program architecture would be really, really hard if you had to anticipate that every class and every method you ever write might be changed to do something completely different by a subclass. It is much better to decide up-front which elements are supposed to be changeable and which aren’t, and to enforce the unchangeablility via final.

You could also do this via comments and architecture documents, but it is always better to let the compiler enforce things that it can than to hope that future users will read and obey the documentation.

1
2
3
Final variables --> To create constant variables
Final Methods --> Prevent Method Overriding
Final Classes --> Prevent Inheritance