-6
它引發異常。 如何解決它。如何使其顯示NULL或不空?
public class VaidateString {
public static void main(String[] args) {
String str = null;
if (str.equals(null)) {
System.out.println("It is NULL");
} else {
System.out.println("Not Null");
}
}
}
它拋出了什麼異常?這個例外並不能幫助你解決這個問題嗎? – Gray
使用==而不是「equals」 – burakozgul
if(str == null | str.length()== 0){' – d3r1ck