try {
File file = new File(filepath+"temp.txt");
if (!file.exists()) {
file.createNewFile();
}
FileWriter fw = new FileWriter(file.getAbsoluteFile(), true);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(input+"\n");
bw.close();
fw.close();
} catch(Exception e) { e.printStackTrace(); }
Every time the user enters something, I want it recorded into a text file. The problem is that every time the user enters something, its recorded on the same line. How do I edit this part of my code to write to a file, then start a new line so that next time it writes to a new line.