public
boolean isEmpty()
Returns true if, and only if, length() is 0.
Returns true if, and only if, length() is 0.
class StringIsEmpty{ public static void main(String args[]){ String s1 = ""; String s2 = " "; System.out.println("Is s1 empty " + s1.isEmpty()); System.out.println("Is s2 empty " + s2.isEmpty()); } }
Output
Is s1 empty true Is s2 empty false
No comments:
Post a Comment