I have a string that contains new lines. I send this string to a function to write the String to a text file as:
public static void writeResult(String wr
bufferedWriter.write(text + "\n"); This method can work, but the new line character can be different between platforms, so alternatively, you can use this method:
bufferedWriter.write(text + "\n");
bufferedWriter.write(text); bufferedWriter.newline();