Java String with empty "" or null value

Description

Java String with empty "" or null value

public class Main {
    public static void main(String[] argv) throws Exception {
        String str = "";
        System.out.println(isEmpty(str));
    }/*w  w w.j a  va2  s.  co  m*/
    public static boolean isEmpty(String str) {
        return str == null || str.length() == 0;
    }

}



PreviousNext

Related