
java program using bufferedreader and bufferedwriter

Hi Friend,
Try the following code:
import java.io.*;
class BufferedReaderAndBufferedWriter{
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new FileReader("C:/Hello.txt"));
BufferedWriter out = new BufferedWriter(new FileWriter("C:/new.txt"));
String line="";
while ((line = in.readLine()) != null){
out.write(line);
out.newLine();
}
out.close();
System.out.println("File is copied");
}
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.