Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Java isWhitespace() Method

Java isWhitespace() Method

Java Character ClassJava Character Class


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

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 ClassJava Character Class