This discussion is archived
2 Replies Latest reply: Apr 16, 2010 5:41 AM by 843810 RSS

if(null != <object name>) , if(<object name> != null) - are they different?

843810 Newbie
Currently Being Moderated
Is there a difference between the way the compiler handles the null check of any java object:
Method 1:
if(null != <object name>)
Method 2:
if(<object name> != null)
Question 1: Is there a difference as regards how the compiler processes the above two statements? Is one of the method more efficiently handled than the other?
If no then
Question 2: Why is it a coding practice to usually follow Method 1?

Edited by: Vrishali.Bobade on Apr 15, 2010 7:46 AM

Edited by: Vrishali.Bobade on Apr 15, 2010 11:30 AM