English

The output of the statement: System.out.println(Character.toUpperCase('b')+2); is: - Computer Applications

Advertisements
Advertisements

Question

The output of the statement:

System.out.println(Character.toUpperCase('b')+2); is:

Options

  • 66

  • 100

  • 68

  • 98

MCQ
Advertisements

Solution

68

Explanation:

The function Character.toUpperCase('b') converts the lowercase character ‘b’ to uppercase ‘B’. In Java, the ASCII value of the uppercase character 'B' is 66. When an integer is added to a character (66 + 2), Java performs numeric addition, resulting in 68.

shaalaa.com
  Is there an error in this question or solution?
2025-2026 (March) Official Board Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×