I have a simple application that yet would trash a text file (it\'s just practice) I\'m only 3 days with Java yet. Problem is there are no errors until you run the program then
Actual writing while being in a loop will not take place unless you call file.flush() method.
FileWriter fileWriter = new FileWriter("hello.txt"); try { for (int i = 0; i < 10; i++) { fileWriter.write(line); fileWriter.flush(); } } finally { fileWriter.close(); }