java – null!= The difference between variable and variable= null

null!= Variable and variable= What's the difference between null?

if ((null != value1) || (null != value2) || (null != value3)) {
            .......
            .......
            .......
}

or

if ((value1 != null) || (value2 != null) || (value3 != null)) {
                .......
                .......
                .......
}

Please suggest the best one and the logical changes between these?

Solution

No difference

But people often write "ABC" Equals (foo) instead of foo Equals ("ABC") to avoid zero exceptions

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>