ICSE Class 10 Computer Applications
Question 10 of 16
Library Classes — Question 10
Back to all questions 10
Question Question 8
How can you check if a given character is a digit, a letter or a space?
We can check if a given character is a digit, a letter or a space by using the following methods of Character class:
isDigit(char) — It returns true if the specified character is a digit; returns false otherwise.
Syntax:boolean isDigit(char ch)isLetter(char) — It returns true if the specified character is a letter; returns false otherwise.
Syntax:boolean isLetter(char ch)isLetterOrDigit(char) — It returns true if the specified character is a letter or a digit; returns false otherwise.
Syntax:boolean isLetterOrDigit(char ch)isWhitespace(char) — It returns true if the specified character is whitespace; returns false otherwise.
Syntax:boolean isWhitespace(char ch)