写的时候报空指针,请问为啥呢 ,文件名加后缀.txt就有文件找不到异常,又是为啥捏
public static void main(String[] args) throws IOException {
FileReader fr=new FileReader("d:\\3.txt");
OutputStreamWriter osw= new OutputStreamWriter(System.out);
BufferedReader br=new BufferedReader(fr);
BufferedWriter bw= new BufferedWriter(osw);
String line = null;
while ((br.readLine())!=null) {
bw.write(line); //这一行报空指针
}
br.close();
bw.close();
} |
|