Java test String is null or empty Java String getChars方法示例. Java String getBytes() 方法示例 Java test String is null or empty import java.lang.*; public class StringDemo { public static void main(String[] args) { String str = "codingdict"; // 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()); } } Java String getChars方法示例. Java String getBytes() 方法示例