What is the method to check whether a character is a letter or digit?

ICSE Class 10 Computer Applications PYQ · 2024 Paper · Section A

1(ix)1 Mark · 2024 · Section A · 2024 Paper

What is the method to check whether a character is a letter or digit?

Show SolutionHide Solution↓

isLetterOrDigit(char)

Reason — In Java, the method Character.isLetterOrDigit(char ch) is used to check whether a given character ch is either a letter (A-Z or a-z) or a digit (0-9).

Analysing Other Options:

  1. isDigit(char) – This method only checks if the character is a digit, not a letter.
  2. isLetterOrDigit() – Incorrect because this method requires a character parameter.
  3. isLETTERorDIGIT(char) – Java methods are case-sensitive, and method names follow camelCase. This method name does not exist.
← Previous questionNext question →

Browse the free Computer Applications sample bank