public StormAnalysis(){
try {
fScanner = new Scanner(new File("tracks1949to2010_epa.txt"));
while(fScanner.hasNextLine()){
System.out.println(fScanner.nextLine());
}
} catch (FileNotFoundException e) {
System.out.println("File not found. Try placing the tracks1949to2010_epa.txt in the same folder as StormAnalysis.java");
e.printStackTrace();
}
}
The above is my code (and I also have an image of the error : http://folk.uio.no/arnabkd/test/images/error-code-task.jpg
As you can see, the txt file is in the same folder as the StormAnalysis.java file. In addition, the code works if I change the file path to "weather.dat" (which was given as another task/problem).
Any ideas will be appreciated!
See Question&Answers more detail:os