+ 4

Why '8' * '7' = 3080?

Arithmetic operations in Java

28th Jan 2017, 1:16 AM
Araujo J. L.
Araujo J. L. - avatar
2 Respostas
+ 4
The characters in ' ' are converted to integers. The ASCII code for '7' is 55 and for '8' it is 56. 55*56==3080 ASCII code source: http://www.theasciicode.com.ar/
28th Jan 2017, 1:29 AM
Jafca
Jafca - avatar
+ 1
Yes, it is true. Because the digits are in ' ', Java recognites them as chars. So the result is a multiplication of their ASCII codes, 56 * 55.
28th Jan 2017, 1:42 AM
Petr Hatina
Petr Hatina - avatar