Java isWhitespace() Method
The isWhitespace() method is used to determine whether the specified character is a whitespace character. Whitespace characters include: space, tab key, and line break.
Syntax
boolean isWhitespace(char ch)
Parameters
ch-- The character to be tested.
Return Value
Returns true if the character is a whitespace character; otherwise returns false.
Example
Example
public class Test {
public static void main(String args[]) {
System.out.println(Character.isWhitespace('c'));
System.out.println(Character.isWhitespace(' '));
System.out.println(Character.isWhitespace('\n'));
System.out.println(Character.isWhitespace('\t'));
}
}
The output of the above program is:
false true true true
Other Extensions
Java Character Class