String isblank() method in Java 11

Below Java program explains how to use the String isBlank() method which has introduced in Java 11 version. Please go through below code and understand it in detail.

public class StringBlank
{
	public static void main(String[] args)
	{
		String a1 = "";
		String a2 = "    ";
		String a3 = "abba";
		
		System.out.println("is a1 blank?: " + a1.isBlank());
		System.out.println("is a2 blank?: " + a2.isBlank());
		System.out.print("is a3 blank?: " + a3.isBlank());
	}
}

Output : is a1 blank?: true

is a2 blank?: true

is a3 blank?:false

Share on Whatsapp !

Comments

comments

Share