java writing to a text file
java
Solution
Try `out.newLine();`
So, it would be
for (int i = 0; i < 4; i++) {
out.write("test " + "\n");
out.newLine();
}
Source (Java API)
Problem
I would like the following to be printed test1 test2 test3 test4 But I can't seem to get the text to the next line. Please help ``` import java.io.*; public class MainFrame { public static void main(String[] args) { try { BufferedWriter out = new BufferedWriter(new FileWriter("file.txt")); for (int i = 0; i < 4; i++) { out.write("test " + "\n"); } out.close(); } catch (IOException e) {} } } ```