Write code to check if a string is Empty using || (logical or)
First compare for null value then compare for empty string.
//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 v a 2 s . c om public static boolean isEmpty(String string) { return string == null || string.trim().length() == 0; } }