新手求助!代码编译无错,运行不出,找不到指定的文件? 这个是为何? 请懂的同学指教!!!
package jichu;
import java.io.*;
public class CopyFile {
public static void main(String[] args) {
FileWriter fw= null;
FileReader fr= null;
try{
fr = new FileReader("C:\\2.txt");
fw = new FileWriter("F:\\2.txt");
int len=0;
while((len=fr.read())!=-1){
fw.write(len);
fw.flush();
}
}catch(IOException e){
e.printStackTrace();
throw new RuntimeException();
}finally{
try{
if(fw!=null)
fw.close();
}catch(IOException e){
throw new RuntimeException();
}finally{
try{
if(fr!=null)
fr.close();
}catch(IOException e){
throw new RuntimeException();
}
}
}
}
} |