您好我的代码中有这个
File file = new File("words.txt");
Scanner scanFile = new Scanner(new FileReader(file));
ArrayList<String> words = new ArrayList<String>();
String theWord;
while (scanFile.hasNext()){
theWord = scanFile.next();
words.add(theWord);
}
Run Code Online (Sandbox Code Playgroud)
但出于某种原因,我得到了一个
java.io.FileNotFoundException
我将words.txt文件放在与所有.java文件相同的文件夹中
我究竟做错了什么?谢谢!