Computer Applications
Give the output of the following Character class methods:
(a) Character.toUpperCase ('a')
(b) Character.isLetterOrDigit('#')
Java
Java Library Classes
ICSE 2023
21 Likes
Answer
(a) Character.toUpperCase ('a')
A
Working
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('#')
false
Working
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.
Answered By
13 Likes
Related Questions
Evaluate the expression when the value of x = 4:
x *= --x + x++ + x
Convert the following do…while loop to for loop:
int x = 10; do { x––; System.out.print(x); }while (x>=1);
Rewrite the following code using the if-else statement:
int m = 400; double ch = (m>300) ? (m / 10.0) * 2 : (m / 20.0) - 2;
Give the output of the following program segment:
int n = 4279; int d; while(n > 0) { d = n % 10; System.out.println(d); n = n / 100; }