1、java拷贝字符文件

2、代码如下:

package Demo1;
import java.io.*;
public class copyfile { public static void main(String[] args) {
try {
cp();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} public static void cp() throws IOException
{
FileWriter fw=null;
FileReader fr=null;
char a[]=new char[];
int len=;
fr=new FileReader("D:\\Eclipse_jee_java\\javaDemo\\Demo1\\src\\Demo1\\demo1.java");
fw=new FileWriter("F:\\copy.text");
while((len=fr.read(a))!=-)
{
fw.write(a, , len);
}
fr.close();
fw.close();
} }
05-11 22:45