Java examples for Language Basics:String
How to check whether the given string is empty
public class Main { public static void main(String args[]){ // w w w . j av a2 s . c om String str1 = ""; String str2 = null; String str3 = "Hello World"; System.out.println("Is String 1 empty? :" + str1.isEmpty()); System.out.println("Is String 3 empty? :" + str3.isEmpty()); } }