What is Final keyword in Java?
In Java, the final keyword is used to restrict the user. It can be used in various contexts, which ends up restricting what the user can define and use. There are three primarily ways in which a Final keyword can be applied.
- Variable: when a variable is made final, it becomes constant, which means that once assigned a value of the variable can never be changed.
- Method: If any method is made finale, it means that it cannot be overridden by subclasses.
- Class: In any class is made final, it means that it cannot be extended.