0
我正在个人项目上工作,但我有一个问题,我似乎无法弄清楚。扫描仪故障。没有脚本错误,但控制台给出错误
public void setvars() {
File file = new File("config.txt");
try {
Scanner sc = new Scanner(file);
while(sc.hasNextLine()) {
//int OESID = sc.nextInt(); this variable isnt used yet.
String refresh = sc.next();
sc.close();
textFieldtest.setText(refresh);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
在它告诉我的错误是while(sc.hasNextLine()) {
控制台我不能弄明白。任何指针/建议将不胜感激!
有什么错误?什么是扫描仪对象? – 2013-02-16 15:55:48