vijai ganesh wrote:I want to know the details about the final keyword...
What is the use of preventing a method from overriding by using final keyword...
If the method should not be overriden in sub classes (i.e: that the implementation is complete/suficient so subclasses can be satisfied with this one). In that way other parts of the application can make sure the behavior of the method in any class (when used).
The final keyword may be applied to a class, indicating the class may not be extended (subclassed).
The final keyword may be applied to a method, indicating the method may not be overridden in any subclass.
A class may never be both abstract and final. abstract means the class must be extended, while final
means it cannot be.
A method may never be both abstract and final. abstract means the method must be overridden, while
final means it cannot be.