What is system.in

前端 未结 9 1212
隐瞒了意图╮
隐瞒了意图╮ 2021-02-06 05:50

Consider this Scanner input example.

Scanner user_input = new Scanner( System.in );

Here Scanner is the CLASS.

9条回答
  •  萌比男神i
    2021-02-06 06:13

    The Scanner constructor's parameter System.in references the static InputStream field in defined in the final System class. As a static field in requires its class identifier.

    Oracle states that in is the "standard" input stream1, not that System.in is. The quotes around standard likely refer to the irony that inputting from a keyboard using a command line interface is no longer the standard, what with them newfangled GUIs and all.

提交回复
热议问题