KnowledgeBoat Logo

Computer Applications

int x = 98; char ch = (char)x; what is the value in ch?

  1. b
  2. A
  3. B
  4. 97

Values & Data Types Java

ICSE 2024

9 Likes

Answer

b

Reason ā€” In Java, when an int value is cast to char, it is converted based on the ASCII code. Since, 98 is the ASCII code of the letter b, hence value of ch is 'b'.

Answered By

7 Likes


Related Questions