Java isWhitespace() Method
The isWhitespace() method is used to determine whether the specified character is a whitespace character. Whitespace includes: space, tab, and newline characters.
Syntax
boolean isWhitespace(char ch)
Parameters
-
ch -- The character to be tested.
Return Value
If the character is whitespace, it returns true; otherwise it 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 execution result of the above program is:
false
true
true
true
Java Character Class