difference between null != something and something != null

前端 未结 7 670
故里飘歌
故里飘歌 2021-01-22 20:04

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 20:17

    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

提交回复
热议问题