I\'m currently working on a lab in my cpe class and we have to create a simple program that scans in strings from a .txt file and prints them to a different .txt file. So fa
public void readwrite() throws IOException
{
// Reading data from file
File f1=new File("D:/read.txt");
FileReader fr=new FileReader(f1);
BufferedReader br=new BufferedReader(fr);
String s = br.readLine();
// Writing data
File f2=new File("D:/write.txt");
FileWriter fw=new FileWriter(f2);
BufferedWriter bw=new BufferedWriter(fw);
while(s!=null)
{
bw.write(s);
bw.newLine();
System.out.println(s);
s=br.readLine();
}
bw.flush();
bw.close();
}