Checking if an object is null
807605Sep 13 2007 — edited Sep 14 2007Hi
I have an object which shows itself as null but does not equal to null when compared. Her is the sequence
Object obj = x.getXXX();
System.out.println(obj);
if(obj != null){
System.out.println("Executing y.do something");
y.doSomething();
}
Here is the result of this
obj = null;
Executing y.doSomething.
My question is if obj is null it should not enter the loop. Please hel me with this . Any suggestions with regards to this is appreciated.
Thanks
Manoj