What does System.in.read actually return?

前端 未结 3 1388
青春惊慌失措
青春惊慌失措 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:26

    System.in.read() reads just one byte.

    49 is the Unicode point value for 1.

    Try to print:

    System.out.println((char)49);

    This will help you to understand it more.

提交回复
热议问题