Java - Write code to check if a string is Empty using String.length() method

Requirements

Write code to check if a string is Empty

both null and "" are empty string.

Hint

Use || operator

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String str = "book2s.com";
        System.out.println(isEmpty(str));
    }/*ww w  . j  a  v  a  2  s. c om*/

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