Having trouble compiling my java file and i think the problem lies here: Problem faced is that i have to include a filenotfoundexception. however, when i add it in, compiler gives me an error of "overridden method does not throw filenotfoundexception" Any idea on how to solve this?
public String getArrival(String flightNumber) {
Scanner scanner = new Scanner(new File("flights.txt"));
while(scanner.hasNextLine()){
String s = scanner.nextLine();
if(s.indexOf(flightNumber)!=-1){
String city = s.split("-")[1];
System.out.println("getArrival(): " + flightNumber + " ==> Arrival city is " + city);
return city;
}
}
}