Java String isEmpty() 方法示例。
String 类的 isEmpty() 方法如果当前字符串的长度为 0,则返回 true。
示例
import java.lang.*;
public class StringDemo {
public static void main(String[] args) {
String str = "tutorialspoint";
//prints length of string
System.out.println("length of string = " + str.length());
//checks if the string is empty or not
System.out.println("is this string empty? = " + str.isEmpty());
}
}输出
length of string = 14 is this string empty? = false
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP