/********************************************************************** * Author: Eric Heim * Date Created: 7/14/2011 * Course: CS0007 * Description: Shows the use of the PrintWriter class to write to a * file. **********************************************************************/ import java.io.FileNotFoundException; import java.io.PrintWriter; public class FileOutput { public static void main(String[] args) throws FileNotFoundException { PrintWriter outputFile = new PrintWriter("myFile.txt"); outputFile.print("This and "); outputFile.println("this will be one the same line."); outputFile.println("This will be on the next line."); outputFile.close(); } }