public class Test3 {
public static void main(String[] args) {
FileReader fr = null;
FileWriter fW = null;
BufferedReader bf = null;
BufferedWriter bW = null;
try {
fr = new FileReader("d:"+File.separator+"from.txt");
fW = new FileWriter("d:"+File.separator+"to.txt");
bf = new BufferedReader(fr);
bW = new BufferedWriter(fW);
String lineString = "";
while(true) {
lineString = bf.readLine();
if(lineString == null) {
break;
}
bW.write(lineString);
bW.newLine();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
bf.close();
bW.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}