0
Я получаю следующее сообщение об ошибке:ошибка: не удается найти символ: класс FileNotFoundException
printfile.java:6: error: cannot find symbol
throws FileNotFoundException {
^
symbol: class FileNotFoundException
location: class printfile
для следующего кода:
import java.io.File;
import java.util.Scanner;
public class printfile {
public static void main(String[]args)
throws FileNotFoundException {
Scanner keyboard = new Scanner(System.in);
System.out.println (" What file are you looking for? ");
String searchedfile = keyboard.next();
File file = new File(searchedfile);
if (file.exists()) {
System.out.println(" Okay, the file exists... ");
System.out.print(" Do you want to print the contents of " + file + "?");
String response = keyboard.next();
if (response.startsWith("y")) {
Scanner filescan = new Scanner(file);
while (filescan.hasNext()) {
System.out.print(filescan.next());
}
}
else {
System.out.print(" Okay, Have a good day.");
}
}
}
}
Как можно разрешить эту ошибку?
'import java.io.FileNotFoundException' ... – Reimeus
спасибо за тонну -A – ashwetzer