且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

找不到文件异常?

更新时间:2022-05-11 15:43:12

给出相对路径,如

BufferedReader reader = new BufferedReader(new FileReader(.\ ss.txt"));

如果它不起作用,则应首先尝试在阅读器代码上方创建一个文件,然后编写一些内容并将其关闭.之后,调用此FileReader命令.这将弄清文件未找到异常背后的原因.
Give the relative path like

BufferedReader reader =new BufferedReader(new FileReader(".\ss.txt"));

and if it does not work then you should first try to create a file just above the reader code and then write something and close it. after that call this FileReader command. It will make clear the reason behind File not found exception.


文件未找到.

我假设没有文件"ss.txt".

File not found.

I assume there is no file "ss.txt".

new FileReader(new File("ss.txt"));



如果没有则创建一个文件.



that would create a file if there is non.