(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



Reach Us

SERVICES

  • ACADEMIC
  • ON-LINE PREPARATION
  • FOUNDATION & CRASH COURSES

CONTACT

B-54, Krishna Bhawan, Parag Narain Road, Near Butler Palace Colony Lucknow
Contact:+918081967119