需要调用Scanner类
Scanner in = new Scanner(System.in); //Scanner类
in.nextLine(); // return String regardless of space
in.next(); // return String , split with space
in.nextInt(); //return int
in.nextDouble(); //return double
in.hasNext(); //return boolean
in.hasNextInt(); //return boolean
in.hasNextDouble(); //return boolean
不可见输入
Console cons = System.console();
String username = cons.readLine("User name: ");
char[] password = cons.readPassword("Password: ");