java String

Java String isEmpty() Code With Examples

Table of Contents

Program

public class StringEmptyblank
{
        	public static void main (String[] args)
		{
		       	   String str = "hello";
			   Boolean v = str.isBlank();
			   System.out.println(v);
			   Boolean v1 = str.isEmpty();
			   System.out.println(v1);


	        }
			  
}

Output

  false
  false    
    

Description

public boolean isBlank()

Returns true if the string is empty or contains only white space codepoints, otherwise false.

Returns:

true if the string is empty or contains only white space codepoints, otherwise false.

Since:

11

public boolean isEmpty()

Returns true if, and only if, length() is 0.

Returns:

true if length() is 0, otherwise false

Since:

1.6