dcsimg

How do I write text to a file?

John Zukowski

Writing text involves writing strings, so you would use a FileWriter.

FileWriter fw = new FileWriter(filename);
PrintWriter pw = new PrintWriter(fw);
pw.println("Hello, World");
pw.close();