当在控制台窗口中输入我的密码时,它是可见的,是否可以更改它以使其不可见?这是我的代码:
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);
最佳答案
使用Console readPassword()
方法:
char[] passwd = System.console().readPassword("[%s]", "Password:");
关于java - 在控制台窗口中隐藏密码输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40618193/