Compiler Error J0096

Class value expected

The compiler detected a synchronization block, but the synchronized statement was applied to an invalid type. This error usually occurs when an identifier other than a class object instance is used with the synchronized statement.

The following example illustrates this error:

public class Simple {
   
   public void method1() {
      int i;
      synchronized (i){ //error 'i' must resolve to an object reference
         // Do something here
      }
   }
}