Java - Write code to create function to check if a string is Empty or null

Requirements

Write code to check if a string is Empty or null

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String str = "book2s.com";
        System.out.println(isEmpty(str));
    }/*from www . ja  v  a2s  .  c  o  m*/

    public static boolean isEmpty(String str) {
        return str == null || str.length() == 0;
    }
}