import java.io.*; public class TestBufferedReader{ public static void main(String[] args){ try{ BufferedReader br = new BufferedReader(new FileReader("D:/Java/TestBufferedReader/TestBufferedReader.java")); BufferedWriter bw = new BufferedWriter(new FileWriter("D:/Java/TestBufferedReader/copy.txt")); String str = null; while((str = br.readLine()) != null){ bw.write(str); bw.newLine(); } bw.flush(); bw.close(); br.close(); } catch(IOException e){ e.printStackTrace(); } } }