Здравствуйте, пытаюсь прочесть файл x.txt но возникает такая ошибка. Подскажите пожалуйста как исправить?
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Programa {
public static void main(String[] args) throws FileNotFoundException {
String separator = File.separator;
String path = separator + "c" + separator + "Users" + separator + "X" + separator + "Desktop" + separator + "x.txt";
File file = new File(path);
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()){
System.out.println(scanner.nextLine());
}
scanner.close();
}
}
Exception in thread "main" java.io.FileNotFoundException: \c\Users\X\Desktop\x.txt (??????? ?? ??????? ????? ????????? ????)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.util.Scanner.<init>(Scanner.java:639)
at Programa.main(Programa.java:12)