I'm at my wits end here.
I'm trying to print a few thousands of lines in a file, using the following:
BufferedWriter bw = new BufferedWriter(new FileWriter(fileName, true));
PrintWriter pw = new PrintWriter(bw, true);
The file already consists of text so I'm appending, hence the true argument, in FileWriter.
Now what seems to be puzzling me for the last two hours, is that around 85-90% of the lines get written into the file, while the FIRST 10-15% are not.
There's nothing wrong with the code in terms of logic, because if i print it in the console, all lines are printed.
Am I missing something here?
I only do pw.close() after all output is printed.