Okay so I scoured this site and a few others looking for the answer to this problem and tried all of the suggestions. Nothing is working and it keeps throwing the File not found exception
.
File inFile = new File("PhoneRecords.txt");
String path = inFile.getAbsolutePath();
try {
System.setIn(new FileInputStream(path));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
Scanner sc = new Scanner(System.in);
After this it tries to use the Scanner in a method below.
public static PhoneCall readNextPhoneCall(Scanner sc){
return new PhoneCall (sc.nextDouble(), sc.nextInt());
}
The text file is in the same directory that I am working in and I double made sure that I name it correctly in my code. Please Help.