public class EmptyString {
public static void main(String[] args) {
String str = new String();
if( (str != null) && (str.isEmpty()) ) {
System.out.println("str is not null and empty");
} else {
System.out.println("str is either null or not empty");
}
}
}
Output:
$ java EmptyString str is not null and empty