What does System.in.read actually return?

前端 未结 3 1384
青春惊慌失措
青春惊慌失措 2020-11-27 22:21

What does :

System.in.read()

return ? The documentation says :

Returns: the next byte of data, or -1 if the end of the

3条回答
  •  失恋的感觉
    2020-11-27 22:39

    When you enter 10, it is not read as an integer but as a String or, more precisely here, an array of bytes.

    49 is the ASCII code for the character 1.

提交回复
热议问题