Please help me with these java syntax issue.
I know obj.equals(null) is wrong, so whats the correct way to write an expression like
if(!obj.equals(null)){
some code
}
I am confused between option 1
if(!(obj == null)){
some code
}
and the other option 2
if(obj != null){
some code
}
There's one more, for an expression like
if(obj.equals(null) || obj2.equals(obj3))
am I correct if I write
if(obj == null || obj2.equals(obj3))
or should this be different ?