119、Java中String类之通过isEmpty判断是否为空字符串

01.代码如下:

package TIANPAN;

/**
 * 此处为文档注释
 *
 * @author 田攀 微信382477247
 */
public class TestDemo {
    public static void main(String args[]) {
        String str = "helloworld";           // 定义字符串
        System.out.println(str.isEmpty());   // 判断字符串对象的内容是否为空字符串(不是null)
        System.out.println("".isEmpty());    // 判断字符串常量的内容是否为空字符串(不是null)
    }
}

02.效果如下

知识有价,如果您认为这篇文章有价值,认同作者的付出,可以微信二维码打赏任意金额给作者(微信号:382477247)哦,谢谢。

猜你喜欢

转载自www.cnblogs.com/tianpan2019/p/12332708.html