(vii) Predict the output of the following code snippet:
char ch='B';
char chr= Character.toLowerCase(ch);
int n=(int) chr-10;
System.out.println((char)n+"\t"+chr);
Solution
chr = 'b'
(ASCII Code for 'b' is 98)
n= 98-10=88
Character with ASCII value 88 is 'X'
Hence final output will be : X b