Write code to check if a string is Empty Or Null
Use ||, the logical or operator
check for null value then check for empty string using isEmpty() method
//package com.book2s; public class Main { public static void main(String[] argv) { String str = "book2s.com"; System.out.println(isEmptyOrNull(str)); }/* ww w . ja v a 2 s .c o m*/ public static boolean isEmptyOrNull(String str) { return str == null || str.isEmpty(); } }