Optional lesson — beyond the AP CS A exam. Writing to files is not on the AP exam (which only reads files); this is here for a fuller picture of Java.
Writing text output
A PrintWriter writes text, just like System.out. It has print (no line break) and println (adds a line break). After writing, call flush() to make sure everything is sent, or close() when finished.