本帖最后由 virgo777 于 2012-04-02 14:02:57 编辑

解决方案 »

  1.   

    你流关闭的地方错了,应该读完了再写完了再关闭fr和fw。
    不然你关了就没法写了。
    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();
    }
    }
    }
    }