Final Variables and Methods
By Ramakrishna on Oct 27, 2008 in define final variable and method
All methods and variables can be overridden by default in subclasses. If we sish to prevent the subclasses from overriding the members of the superclass, we can declare them as final using the key word final as a modifier .
Example:
final int size=100;
final void show(){…….}
Making a method final ensures that the functionality defined in this method will never be altered in any way. Similarly, the value of a final variable can never be changed. Final variables, behave like class variables and they do not take any space on individual objects of the class
