Java - Write code to check if a string is Empty using || (logical or)

Requirements

Write code to check if a string is Empty using || (logical or)

Hint

First compare for null value then compare for empty string.

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String string = "book2s.com";
        System.out.println(isEmpty(string));
    }// w  w  w .  java2 s  .  c om

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