Compiler Error J0112

Cannot assign final variable 'identifier'

The compiler detected an attempt to change the value of a field declared as final. A field declared as final cannot be assigned a value once it has been initialized with a value either at declaration, in an instance initializer, or constructor.

The following example illustrates this error:

public class Simple {
   private final int i = 3;

   public void method1(int arg1) {
      i = arg1; 
      // error: variable 'i' declared final
   }
}