posted 18 years ago
You can create an external text file with
FileWriter writer = new FileWriter(fileName);
where fileName is the name of the file you want to create.
Be careful. With this constructor of FileWriter, if the file already exists, it will be overwritten.
Then you can wrap it in a PrintWriter.
PrintWriter output = new PrintWriter(writer);
and then to write a line to the file and include a newline in the output, you would use
output.println(...);
Make sure that you close the PrintWriter so that any text buffered in memory is written to the file.
output.close();