1.new Scanner(System.in);调用该类API即可
2.因为输入是可见的, 所以 Scanner 类不适用于从控制台读取密码。要想读取一个密码, 可以采用下列代码:
String username = cons.readLine("User name: ");
cha「[] passwd = cons.readPassword("Password:");
标签:cons,读取,密码,控制台,输入,Scanner
来源: https://blog.csdn.net/weixin_45656377/article/details/110198390