import java.io.FileReader; import java.io.FileWriter; class IOTest { public static void main(String[] args) { FileReader fr = null; FileWriter fw = null; try { fr = new FileReader("EditPlus.txt"); fw = new FileWriter("MYIOEditPlus.txt"); char [] cbuf = new char [1024]; int len = 0; while((len = fr.read(cbuf)) != -1) { fw.write(cbuf, 0, len); } } catch (Exception e) { throw new RuntimeException("文件读取失败!"); } finally { if(fr != null) try { fr.close(); } catch (Exception e) { } if(fw != null) try { fw.close(); } catch (Exception e) { } } } }