posted 18 years ago
Yesterday I was working on some project and I discovered that if we get an object, having value null. when we equate that variable with null, it return false, but at the same time if we do something like :
Object obj=null;
if(obj==null){
// some code
}
It was not getting into if statement. but when I tried the following code it worked. Can anybody give me explanation for this.
if(obj!=null){
//some code
}
else{
//some code
}
Please explain me why is this happening