+ 1
Hello guys, I don't understand why the output is 106 can anyone help please?
public class Program { public static void main(String[] args) { char a='2',b='8'; System.out.println(a+b); } }
2 Réponses
+ 3
Because ascii value of '2' is 50 and '8' is 56 if you want the letter 'j' just cast it System.out.print((char)(a+b));
+ 2
If you look at an ASCII table, '2' is not 2, but 32 (hex), or 50 (dec). Same for character '8': his value is 6 units more, 56.
50 + 56 = 106!