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

Requirements

Write code to create a function to check if a string is Empty

Demo

//package com.book2s;

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

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