java coding 8
Write a Java program that prompts the user for a filename and attempts to open the file as follows: Scanner infile = new Scanner(new FileInputStream(filename));
If there an exception thrown as a result, the program should prompt the user to reenter the filename until a valid filename exists. (Make sure to have a textfile as part of the project to open. It should be in the main project folder, not in any of the project subfolders.) Go to the Java API (link in Blackboard) and look up the constructor for the FileInputStream class to determine the exceptions
that the constructor throws.
Note that your program must import both the FileInputStream class, AND the class of the exception type that the constructor of this class throws. Therefore, you must either use:
import java.io.* – to import ALL of the classes in the package or
import java.io.FileInputStream; import.java.io.ExceptionClassName