首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >System.console() NullPointerException

System.console() NullPointerException
EN

Stack Overflow用户
提问于 2016-01-01 18:03:16
回答 5查看 10.6K关注 0票数 2

下面是我的代码:

代码语言:javascript
复制
System.out.println("Enter Username: ");
String unm=System.console().readLine();

System.out.println("Enter Password: ");
char[] pwd=System.console().readPassword();

System.out.println("Welcome: " + "" + " Your password is " + new String(pwd));

为什么我会得到这个错误?

输入用户名:在Cons.main(Cons.java:13)

的线程"main“java.lang.NullPointerException中出现异常

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34555185

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档