代码如下:import java.io.*;public class Copy {
public static void main(String[] args) {
try {
FileReader fr = new FileReader("d:\\java\\Copy.java");
FileWriter fw = new FileWriter("d:\\Copy.TXT");
int b;
while((b = fr.read()) != -1) {
System.out.print((char)b);
fw.write(b);
}
} catch(IOException e) {
e.printStackTrace();
System.out.println("读写错误!");
System.exit(-1);
}
System.out.println("\n复制完成!");
}
}