Hello,
I'm sure there are many ways to accomplish this. An easy suggestion that I have is just wrap the FileWriter with PrintWriter. Then you can use PrintWriter's println(
String) method. Here's a quick code example. The text lines are put in the file on different lines. I confirmed this by opening the file in notepad. Hope this helps!
Cheers,
RL
<pre>
import java.io.*;
public class FileWriting {
public static void main(String[] args) throws IOException {
FileWriter fw = new FileWriter("fubar.txt");
PrintWriter pw = new PrintWriter(fw);
pw.println("These");
pw.println("are");
pw.println("strings");
pw.println("on");
pw.println("different");
pw.println("lines.");
pw.close();
fw.close();
}
}
</pre>
[This message has been edited by Ryan Langley (edited May 15, 2001).]
[This message has been edited by Ryan Langley (edited May 15, 2001).]