Scanner sc = new Scanner(System.in); System.out.println("name is:"); String name = sc.nextLine();
Scaner类在控制台输入可见,
j2se 6 引入了Console类来实现从控制台读取密码
Console cs = System.console(); String name = cs.readLine("name is: "); char[] ps = cs.readPassword("password is:");
输入不显示值;在win系统的dos窗口下运行;