日期:2014-05-20 浏览次数:20674 次
import java.io.*; class Test{ public static void main(String agrs[]){ FileReader fr = null; FileWriter fw = null; BufferedReader br = null; BufferedWriter bw = null; try{ fr = new FileReader("C:/Users/Administrator/Desktop/运行代码/from.txt"); fw = new FileWriter("C:/Users/Administrator/Desktop/运行代码/to.txt"); br = new BufferedReader(fr); bw = new BufferedWriter(fw); String line = null; while(true){ line = br.readLine(); if(line == null){ break; } System.out.println(line); //这个有显示 bw.write(line); //就是这里了,不知道是什么问题 } } catch(Exception e){ System.out.println(e); } finally{ try{ fw.close(); br.close(); fr.close(); br.close(); } catch(Exception e){ System.out.println(e); } } } }