/* FileOutput.java CIS 160 9/8/04 Demonstrates writing data to a file. */ import java.io.*; // needed for file I/O public class FileOutput { public static void main(String[] args) throws IOException { double num = 12.67; // File will be opened for output in same directory program // is running in. It will be created if it does not exist. // The previous contents will be erased if it does exist. PrintWriter out = new PrintWriter(new FileWriter("fout.txt")); // write data to file out.print("David"); out.print(" G."); out.println(" Klick"); out.println(num); out.println("That's all folks!"); out.close(); } }