java write to the end of file with new line
java
Solution
The newline sequence is system dependent. On some systems its `\n`, on others it's `\n\r`, `\r\n`, `\r` or something else entirely different. Luckily, Java has a built in property which allows you to access it:
String newline = System.getProperty("line.separator");
Problem
I want to write results to the end of the file using java ``` FileWriter fStream; try { fStream = new FileWriter("recallPresision.txt", true); fStream.append("queryID=" + queryID + " " + "recall=" + recall + " Pres=" + presision); fStream.append("\n"); fStream.flush(); fStream.close(); } catch (IOException ex) { Logger.getLogger(query.class.getName()).log(Level.SEVERE, null, ex); } ``` I put `"\n"` in the statement , it writes to the file but not with new line I want to print results with new line