Question 11
Back to Exercise
What is the output of the following Java program?
public class Main {
public static void main(String[] args) {
System.out.println(Boolean.parseBoolean("True") + " " + Boolean.parseBoolean("yes") + " " + Boolean.parseBoolean(null) + " " + Character.isDigit('٣') + " " + Character.getNumericValue('Z') + " " + Character.toChars(66)[0]);
}
}
- A true false false true 35 B Correct
- B true true false false 35 B
- C false false false false -1 B
- D true false NullPointerException
Correct Answer: Option A
Only "true" (any case) parses to true; null gives false. isDigit accepts Unicode digits such as Arabic-Indic ٣. getNumericValue treats letters as base-36 digits: Z = 35.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!