有人可以告诉我这里我出错的地方和解决方案,我真的不知道为什么这会给出错误
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Unhandled exception type FileNotFoundException
at Tutorial6Task1.main(Tutorial6Task1.java:8)"
目标是从文件中读取3个整数,并将其打印出来。
源代码......
import java.io.*;
import java.util.*;
public class Tutorial6Task1 {
public static void main(String[] args) throws FileNotFoundException {
Scanner inFile = new Scanner(new FileReader("M:\\eclipse-luna\\Task6\\src\\fileinput1.txt"));
String firstInt = inFile.nextLine();
String secondInt = inFile.nextLine();
String thirdInt = inFile.nextLine();
inFile.close();
System.out.println(firstInt);
}
答案 0 :(得分:1)
在为throws
FileNotFoundException
子句后,您似乎没有重新编译过您的课程