import java.io.Console; public class NewConsole { public static void main(String[] args) { Console c = System.console(); char[] pw = new char[10]; pw = c.readPassword("%s", "pw: "); } }
引用 5 楼 magi1201 的回复:参考 java.exe 与 javaw.exe 区别eclipse 里面执行javaw.exe,拿不到Console 控制台的,放cmd 窗口通过java.exe可以
参考 java.exe 与 javaw.exe 区别
62,634
社区成员
307,269
社区内容
加载中
试试用AI创作助手写篇文章吧