- 1
Challenge question
what is the output of this code? char b = 'a' + 2; System.out.print (b);
4 Answers
+ 25
c
'a'+2 increases a's ASCII value by 2 and assigns the equivalent character to b.
+ 8
c
why?
Take a look at the 'dec' value of each char in the ascii table: https://www.google.ca/search?q=ascii+table&client=ms-android-rogers-ca&prmd=ivn&source=lnms&tbm=isch&sa=X&ved=0ahUKEwie2au6i8PTAhXhzIMKHf3hBs0Q_AUICSgB&biw=360&bih=518
97+2=99;
char value of 99 is c.
+ 8
If error is an option just be sure there isn't anything missing: semi-colon, ', caps etc..
+ 2
ok i was just making sure. cause the only options were
1
3
a2
error
and i knew it wasnt any of them. i guess its just another wrong question



