jsbintask22
2016-10-13 02:45
采纳率: 100%
浏览 8.5k
已采纳

Scanner中异常: java.util.NoSuchElementException?

public void RemoveTest() {
Scanner input = new Scanner(System.in);
System.out.println("Please input Id wanted to delete:");
String idString=null;
while (true) {
idString = input.next();
Student student = map.get(idString);
if (student == null) {
System.out.print("Not exists this student,Please input again:");
continue;
} else {
map.remove(idString);
break;
}
}
input.close();
}

这个方法里面  idString = input.next();一直出现上述错误,Student是我写的一个类,没问题

9条回答 默认 最新

相关推荐 更多相似问题