尝试
java.io.Console.readPassword.你将不得不至少运行Java 6。
/**
* Reads a password or passphrase from the console with echoing disabled
*
* @throws IOError
* If an I/O error occurs.
*
* @return A character array containing the password or passphrase read
* from the console, not including any line-termination characters,
* or null if an end of stream has been reached.
*/
public char[] readPassword() {
return readPassword("");
}
当心,虽然,这doesn’t work与Eclipse控制台。你必须从真正的控制台/ shell /终端/提示运行程序才能测试它。
最后
以上就是勤奋外套最近收集整理的关于java中怎么隐藏输入内容_java – 在命令行中隐藏输入的全部内容,更多相关java中怎么隐藏输入内容_java内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复