Java Data Type Tutorial - Java Character.isSpace(char ch)








Syntax

Character.isSpace(char ch) has the following syntax.

@Deprecated public static boolean isSpace(char ch)

Example

In the following code shows how to use Character.isSpace(char ch) method.

public class Main {
//from   w w  w .  ja  v a2 s  . c  o m
   public static void main(String[] args) {
      char ch1 = ' ';
      char ch2 = '\u2028';  // LINE_SEPARATOR

      boolean b1 = Character.isSpaceChar(ch1);
      boolean b2 = Character.isSpaceChar(ch2);

      System.out.println("ch1 is a space character is " + b1);
      System.out.println( "ch2 is a space character is " + b2);
   }
}

The code above generates the following result.