Exceptions help
Im making a program which allows the user to input a file name. If the file name does not match the file to be found (ints10.txt) then the program will tell the user the file does not exist. The program will continue until the user gets the right filename. Then it will say you found the file.
WHAT is wrong with my code:
import java.util.*;
public class Exceptions{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
boolean answer = ints10.txt;
while (answer !=ints10.txt) {
try {
System.out.println("Enter the file name");
answer = in.nextBoolean();
}
catch (FileNotFoundException) {
in.nextLine();
System.out.println("Input was the correct file.");
}
}
System.out.println ("You found the file.");
}
}

