问题描述
这里是if,用于检查scanner.hasNextInt() 发生了什么:
if (scanner.hasNextInt()){
System.out.println("we");
}else{
System.out.println("kill me");
}
public class LightBot {
String map[] [];
int crow,ccol,cdir;
LightBot(String fileName,int row,int col,int dir){
try {
Scanner scanner= new Scanner(fileName);
int [] tall=new int[100];
int i=0;
FileReader inputFil = new FileReader(fileName);
BufferedReader in = new BufferedReader(inputFil);
String s =in.readLine();
System.out.println("r");
if (scanner.hasNextInt()){
System.out.println("we");
}else{
System.out.println("kill me");
}
while(scanner.hasNextInt()){
System.out.println("sru gjl g");
try {
tall[i++] = Integer.parseInt(s);
System.out.println("ff");
}
catch (NumberFormatException ex) {
System.out.println("WTF");
continue;
}
}
}catch (IOException error) {
System.out.println("error");;
}
}
public static void main(String args[]){
LightBot l= new LightBot("test.txt",0);
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)