java.io.FileNotFoundException(系统找不到指定的文件)

    文件需要放在工程目录下.

    eg:

    public class Example{


public static void main(String[] args) throws Exception {


BufferedReader bufferedReader = new BufferedReader(new FileReader("zj.txt"));
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("jz.txt"));
String str;
while ( (str=bufferedReader.readLine()) != null) {
bufferedWriter.write(str);

}
bufferedReader.close();
bufferedWriter.close();
}


}


zj.txt 应该存在于工程目录下,而不是工程的子目录,生成的文件也在工程目录下.

你可能感兴趣的:(个人笔记)