I have to open a text file named Grades.txt and everytime I try to open it, it gives me a FileNotFoundException. I am not sure how to overcome this and get my program to read the file.
import java.io.File; import java.io.IOException; import java.util.Scanner; public class EchoFileData { public static void main(String [] args) throws IOException { int grade; File inputFile = new File( "Grades.txt" ); Scanner scan = new Scanner( inputFile ); while ( scan.hasNext() ) { grade = scan.nextInt(); System.out.println( grade ); } } }