本帖最后由 谢威 于 2013-7-18 10:34 编辑
大家帮忙看下哪错了,显示找不到符号a- import java.io.*;
- class CopyText
- {
- public static void main(String[] args) throws IOException
- {
- Copy_2();
- }
- public static void Copy_2()
- {
- FileReader fr = null;
- FileWriter fw = null;
- try
- {
- fr = new FileReader(a.txt);
- fw = new FileWriter(b.txt);
- char[] buf = new char[1024];
- int len = 0;
- while ((len=fr.read(buf))!=-1)
- {
- fw.write(buf,0,len);
- }
- }
- catch (Exception e)
- {
- throw new RuntimeException("读写失败");
- }
- finally
- {
- if(fr!=null)
- try
- {
- fr.close();
- }
- catch (IOException e)
- {
- }
- if(fw!=null)
- try
- {
- fw.close();
- }
- catch (IOException e)
- {
- }
- }
- }
- }
复制代码 |
|