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 " + "
");
}
out.close();
} catch (IOException e) {}
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…