Java检查String是否为空


Java检查String是否为空

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());

   }

}