What does :
System.in.read()
return ? The documentation says :
Returns: the next byte of data, or -1 if the end of the
When you enter 10, it is not read as an integer but as a String or, more precisely here, an array of bytes.
10
49 is the ASCII code for the character 1.
1