null == foo versus foo == null [duplicate]
问题 This question already has answers here : Which is more effective: if (null == variable) or if (variable == null)? [duplicate] (9 answers) Closed 6 years ago . This may just be a style question, but I'm reading a Java coding book ('Programming Android') and the writer all declares null first before a variable method, a practice I am not familiar with. For example: if (null == foo) { //code here } or if (null != foo) { //code here } instead of if (foo == null) { //code here } I can't see how