final variables : final « Modifiers « SCJP






final variables cannot be reinitialized once assigned a value.
final reference variables cannot refer to a different object once the object has been assigned.
final reference variables must be initialized before the constructor completes.
final is the only modifier available to local variables.
final methods cannot be overridden in a subclass.


public class MainClass{
    final int i = 0;
    i= 1; // error
    public static void main(String[] argv){
    
    }
}








3.6.final
3.6.1.final variables
3.6.2.A final class cannot be subclassed.
3.6.3.If a final variable references to an object, the reference must stay the same(not the object)
3.6.4.A final method may not be overridden
3.6.5.final local variable indicates that the value of a variable cannot be changed once assigned a value.
3.6.6.Local variables and method parameters may also be declared as final to enable them to be accessed by local inner classes.
3.6.7.final method may not be overridden.
3.6.8.The final keyword means that the field cannot be changed once initialized.
3.6.9.A final variable can't have its value changed after initialization.
3.6.10.A local variable or method parameter must be declared final if it is to be used by an inner class declared inside a method.