+ 1

Why is the output of System.out.print('2'+'2'); , 100?

'2'+'2' == 100

15th Jul 2021, 2:58 AM
Jhun Ray Omiping
Jhun Ray Omiping - avatar
2 Respostas
+ 5
'2' is char literal. When char is involved in calculation, their ASCII code is used as value. ASCII code for '2' is 50, I guess you now got it all figured out.
15th Jul 2021, 3:57 AM
Ipang
+ 1
Ipang thankkk u
15th Jul 2021, 4:34 AM
Jhun Ray Omiping
Jhun Ray Omiping - avatar