A final is a keyword in java. If final keyword is applied to a variable, then the variable will become a constant. If it applied to method, sub classes cannot override the method. If final keyword is applied to a class we cannot extend from that class.
‘final’ keyword is used in two ways:
It is used to declare constants as:
Final double PI = 3.14159; // PI is constant
It is used to prevent inheritance as:
Final class A // sub class to A cannot be created.