import java.io.*; /** * This code illustrates the use of PrintWriter * @author e. adams * */ public class Lecture6_8 { public static void main (String args []) { PrintWriter myPrintWriter; myPrintWriter = null; try { myPrintWriter = new PrintWriter ("aname.txt "); } catch (IOException e) { System.out.println (" couldn’t open file "); } myPrintWriter.println ("Hello World "); myPrintWriter.println ("Goodbye World"); myPrintWriter.close(); } }