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

Requirements

Write code to check if a string is Not Empty using and operator

Demo

//package com.book2s;

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

    public static boolean isNotEmpty(String str) {
        return ((str != null) && (str.length() > 0));
    }
}