我正在做一个个人项目,但我有一个我似乎无法弄清楚的问题。
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()) {
我无法弄清楚。任何指针/建议将不胜感激!