What's wrong with my use of the catch statement below in attempting to catch a file not found exception? My IDE says "Unreachable catch block for FileNotFoundException this exception is never thrown from the try statement body, how do I correct this? It also does not like the (temp) in the return statement says local variable temp may not have been initialized.
public static Scanner openInputFile() throws FileNotFoundException
{
String temp;
Scanner in = new Scanner(System.in);
try
{
System.out.println("Please enter the name of the input file.");
temp = (in.nextLine());
return new Scanner(new File(temp));
}
catch(FileNotFoundException e)
{
System.out.println("FileNotFoundException: " + e.getMessage());
}
}