天天看點

在對對象判斷為空:Object != null 和 null != Object的差別?

@Test
    public void testDemo1(){
        String str = null;
        if (str==null){
            return;
        }
    }
 
    @Test
    public void testDemo2(){
        String str = null;
        if (null==str){
            return;
        }
    }      

一種開發規範,是以我們要使用 null != object 

繼續閱讀