当我输入我的密码到控制台窗口时,它是可见的,无论如何这可以改变,以便它不可见?这是我的代码:
String user, pass, host;
Scanner sc = new Scanner(System.in);
System.out.println("Type userid, password, hostname or ipaddress: ");
user = sc.next();
pass = sc.next();
host = sc.next();
System.out.println(user + " " + pass + " " + host);
Methods md = new Methods();
md.createTable(user, pass, host);
答案 0 :(得分:0)
使用Console readPassword()
方法:
char[] passwd = System.console().readPassword("[%s]", "Password:");