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
The newline sequence is system dependent. On some systems its
\n, on others it’s\n\r,\r\n,\ror something else entirely different. Luckily, Java has a built in property which allows you to access it: