Compiler Error J0231

Expression statement must be assignment, method call, increment, decrement, or "new"

The compiler detected an invalid expression statement. An expression statement is a statement that can reside on its own line of source code. The following are some examples of valid expression statements:

m_cars.changeColor(); //Method calls
int x = y + z; //Assignment statements
j++; //Increment statement
m_tempVar1 += 3;
new Simple();

The following are examples of invalid expression statements:

1+2;  //error: No assignment statement
j+k-method1();  //A method call but not a valid assigment statement
var1 == var2;  /*Comparison statements should be contained in flow
                 control statements*/