Compiler Error J0065

Cannot assign to this expression

The compiler detected an expression in the position normally held by an lvalue for assignment. This error usually occurs when an expression is being assigned a value but the expression is not capable of accepting the assignment.

The following example illustrates this error:

public class Simple {
   
   public void method1() {
   
      int x = 0;
      int y = 1;
   
      x++ = y; //error: '++' not valid
   }
}