检查空值时,我使用:
String str; if(str == null){ //... }
但我也见过这个:
if(null == str){ //... }
使用一个优于另一个是否有任何优势?或者只是为了提高可读性?
java
java ×1