public class CopyFileTest4{
public static void main(String[] args) throws IOException{
FileReader fr = new FileReader("CopyFileTest4.java");
BufferedReader br = new BufferedReader(fr);
FileWriter fw = new FileWriter("temp.txt");
PrintWriter pw = new PrintWriter(fw);
String read = br.readLine();
while(read!=null){
pw.println(read);
read = br.readLine();
}
pw.flush();
pw.close();
}
}
//PrintWriter可以提供println()方法,直接输出一行