difference between null != something and something != null

前端 未结 7 1753
庸人自扰
庸人自扰 2021-01-22 11:30

Is there a difference between null != something and something != null in Java. And if there is a difference then which one should I use and why??

7条回答
  •  轮回少年
    2021-01-22 12:19

    its probably comming from the so-called joda-conditions where you write "bla" == myVariable instead of myVariable == "bla" because it could happen to accidentially write myVariable = "bla" which returns "bla" in some languages but also assign "bla" to myVariable

提交回复
热议问题