FileNotFoundException:系統(tǒng)找不到指定的文件我有一份名為“word.txt".它位于與我的目錄相同的目錄中。java檔案。但是,當(dāng)我試圖在下面的代碼中訪問(wèn)它時(shí),找不到文件錯(cuò)誤發(fā)生:Exception in thread "main" java.io.FileNotFoundException: word.txt
(The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.util.Scanner.<init>(Unknown Source)
at Hangman1.main(Hangman1.java:6)這是我的密碼:import java.io.File;import java.util.*;public class Hangman1 {
public static void main(String[] args) throws Exception {
Scanner input = new Scanner(new File("word.txt"));
String in = "";
in = input.nextLine();
}}
FileNotFoundException:系統(tǒng)找不到指定的文件
叮當(dāng)貓咪
2019-11-05 12:04:44