此代码段应该可以解决问题:
private String readLine(String format, Object... args) throws IOException { if (System.console() != null) { return System.console().readLine(format, args); } System.out.print(String.format(format, args)); BufferedReader reader = new BufferedReader(new InputStreamReader( System.in)); return reader.readLine();}private char[] readPassword(String format, Object... args) throws IOException { if (System.console() != null) return System.console().readPassword(format, args); return this.readLine(format, args).toCharArray();}在Eclipse中进行测试时,你的密码输入将清晰显示。至少,你将能够进行测试。只是在测试时不要输入你的真实密码。保留供生产使用



