Conditional Statements difference

后端 未结 7 1503
日久生厌
日久生厌 2020-12-20 16:24

Is there any difference between below two statements

if (null != obj)

and

if (obj != null)

If both treate

7条回答
  •  轮回少年
    2020-12-20 16:32

    The use of the first form

    if (blah == obj) 
    

    stems from the days when compilers would not catch if (obj = blah) i.e. unintentional assignment, unless compile warning level was set to maximum

提交回复
热议问题