Java - Write code to check if a string is Empty using tenary operator

Requirements

Write code to check if a string is Empty using tenary operator

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String chkStr = "book2s.com";
        System.out.println(isEmpty(chkStr));
    }//from  ww w .  jav a2  s  . c o  m

    public static boolean isEmpty(String chkStr) {
        if (chkStr == null) {
            return true;
        } else {
            return "".equals(chkStr.trim()) ? true : false;
        }
    }
}

Related Exercise