if (!"".equals(name)) {//將""寫在前頭,這樣,不管name是否為null,都不會出錯。 //do something } 下面,我們舉一個簡單的例子: TestNullOrEmpty.java.
確定! 回上一頁