Local variables and method parameters may also be declared as final to enable them to be accessed by local inner classes. : final « Modifiers « SCJP






public class MainClass {
  public static void main(String[] argv) {
    System.out.println();

    final int i = 0;

    class InnerClass {
      public InnerClass() {
        System.out.println(i);
      }
    }
  }
}








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.