Home / Questions / Give the output of the following Character class methods: (a) Character.toUpperCase ('a') (b) Character.isLetterOrDigit('#')
Explanatory Question

Give the output of the following Character class methods:

(a) Character.toUpperCase ('a')

(b) Character.isLetterOrDigit('#')

👁 70 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

(a) Character.toUpperCase ('a')

Output
A
Explanation

In Java, the Character.toUpperCase(char ch) method is used to convert a given character to its uppercase equivalent, if one exists. So, the output is uppercase 'A'.

(b) Character.isLetterOrDigit('#')

Output
false
Explanation

Character.isLetterOrDigit() method returns true if the given character is a letter or digit, else returns false. Since, hash (#) is neither letter nor digit, the method returns false.