-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