Java == operator. "Invalid assignment operator"
- by Tom
Hi,
I was trying to write a simple method
boolean validate(MyObject o)
{
return o.getPropertyA() == null && o.getPropertyB()==null;
}
And got a strange error on the == null part. Maybe my Java is rusty after a season in PLSQL.
Consider this:
Integer i = 4;
i ==null; //compile error: Syntax error on token ==. Invalid assignment operator.
Integer i2 = 4;
if (i==null); //No problem
How can this be ? Any explanation ?
Im using jdk160_05.