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));
    }//from w ww .  j av  a2  s  .  c  om

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