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 {
//  w  w w .  j  av a2s .co  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.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable