Compiler Warning J5001

Local variable 'identifier' is initialized but never used

The compiler detected an initialized variable that was not referenced in any class code. This message occurs at warning level 3 or greater. Use the variable or remove its declaration.

The following example illustrates this warning:

public class Simple {
   
   public int method1() {
   
      int i = 1;
      return 1;
      // warning: 'i' is never used
   }
}