Java程序检查字符串是否为空
以下是我们的字符串-
String str = "";
我们将使用isEmpty()方法检查它是否为空。结果将是布尔值-
str.isEmpty()
以下是一个例子-
示例
public class Demo {
public static void main(String[] args) {
String str = "";
System.out.println("String is empty: "+str.isEmpty());
}
}输出结果
String is empty: true
热门推荐
10 小众婚礼惊喜祝福语简短
11 虎年祝福语 诗句唯美简短
12 新春祝福语大全 英语简短
13 结婚不在现场祝福语简短
14 晚安好梦祝福语简短
15 高考加油祝福语简短押韵
16 拜年祝福语英文长句简短
17 爸爸生病结婚祝福语简短
18 新年祝福语简短小猪