KnowledgeBoat Logo

Output Questions for Class 10 ICSE Computer Applications

Find the output of the following program snippet:


char ch = 'A';
char chr = Character.toLowerCase(ch); 
int n = (int)chr-32;
System.out.println((char)n + "\t" + chr);

Java

Java Library Classes

71 Likes

Answer

A       a

Working

Character.toLowerCase() converts 'A' to 'a'. ASCII code of 'a' is 97. n becomes 65 — (int)chr-32 ⇒ 97 - 32 ⇒ 65. 65 is the ASCII code of 'A'.

Answered By

35 Likes