if('\0' == b){
System.out.println("b为空字符");
}else{
System.out.println("判断不为空");
}
String str = String.valueOf(b);
if ("\0".equals(str)) {
System.out.println("为空");
} else {
System.out.println("不为空" + str);
}
if (str.length() == 1) {
System.out.println("为空");
} else {
System.out.println("不为空" + str);
}
注:String类型的空格哪怕用 char[] haveNull = str.toCharArray();转换,char数组是变成了空格的字符进行存储,而非'\0'的形式!