VOOZH about

URL: https://www.geeksforgeeks.org/java/character-isletterordigit-in-java-with-examples/

⇱ Character.isLetterOrDigit() in Java with examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Character.isLetterOrDigit() in Java with examples

Last Updated : 23 Jan, 2026

The java.lang.Character.isLetterOrDigit(char ch) method is an inbuilt method in Java that checks whether a given character is either a letter or a digit.


Output
true

Explanation: This example checks whether the character 'A' is a letter or digit.

Syntax

public static boolean isLetterOrDigit(char ch)

  • Parameters: "ch " The character to be tested.
  • Return Value: Returns true if the character is a letter or digit; otherwise, returns false.

Example 1: Checking Letter and Digit Characters


Output
Z is a letter/digit ? true
2 is a letter/digit ? true

Explanation: Both 'Z' (a letter) and '2' (a digit) satisfy the condition, so the method returns true.

Example 2: Checking Letter and Special Character.


Output
D is a letter/digit ? true
/ is a letter/digit ? false

Explanation:

  • Two characters are defined: 'D' (a letter) and '/' (a special character).
  • Character.isLetterOrDigit() checks each character.
  • The method returns true for the letter and false for the special character, and the results are printed.

Related Topics:

Comment