public class TestEmpty
{
public static void main(String[] args){
String a = ” “;
// if (a.isEmpty())
if (a. trim ().isEmpty())
{
System.out.println(“It is empty”);
}
else
{
System.out.println(“It is not empty”);
}
}
}
public class TestEmpty
{
public static void main(String[] args){
String a = ” “;
// if (a.isEmpty())
if (a. trim ().isEmpty())
{
System.out.println(“It is empty”);
}
else
{
System.out.println(“It is not empty”);
}
}
}
文章来源:智云一二三科技
文章标题:Java里如何判断一个String是空字符串或空格组成的字符串
文章地址:https://www.zhihuclub.com/170873.shtml