import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class CopyFileTest {
public static void main(String[] args) throws IOException {
FileReader fr=new FileReader("f:\\myDoc\\s1.txt");
BufferedReader br=new BufferedReader(fr);
FileWriter fw=new FileWriter("f:\\myDoc\\s2.txt");
BufferedWriter bw=new BufferedWriter(fw);
String line=br.readLine();
while(line!=null)
{
bw.write(line);
bw.newLine();
bw.flush();
line=br.readLine();
}
}
}
运行完机子直接死机。
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class CopyFileTest {
public static void main(String[] args) throws IOException {
FileReader fr=new FileReader("f:\\myDoc\\s1.txt");
BufferedReader br=new BufferedReader(fr);
FileWriter fw=new FileWriter("f:\\myDoc\\s2.txt");
BufferedWriter bw=new BufferedWriter(fw);
String line=br.readLine();
while(line!=null)
{
bw.write(line);
bw.newLine();
bw.flush();
line=br.readLine();
}
}
}
运行完机子直接死机。