日期:2014-05-20 浏览次数:20819 次
public static void fileput(String filePath) { int a = 0; FileReader fr = null; FileWriter fw = null; try { fr = new FileReader(filePath); fw = new FileWriter("c:/javatest/cool.txt"); while ((a = fr.read()) != -1) { fw.write(a); } } catch (IOException e1) { System.out.println("就是错误!"); } finally { if (fr != null) { try { fr.close(); } catch (IOException e) { e.printStackTrace(); } } if (fw != null) { try { fw.close(); } catch (IOException e) { e.printStackTrace(); } } } }