I\'m writing a program that writes sets of observations in the form of a String array (from User input) to file. I am able to write an observation to a .txt file and then ad
You need to push a line separator into the buffer.
newLine();
Here's the code
for(int i = 0; i < observation.length; i++) {
try (BufferedWriter bw
= new BufferedWriter(new FileWriter("birdobservations.txt", true))) {
String s;
s = observation[i];
bw.write(s);
bw.newLine();
bw.flush();
} catch(IOException ex) {
ex.printStackTrace();
}
}