import java.io.*; public class PrintStreamExample { public static void main(String[] args) throws FileNotFoundException { // NOTE: This is an example of how to use the PrintStream object // to print to a file called "Hello.java" We've just written // code that writes code. Hello.java is an actual program we // can compile and run. Cool! PrintStream stream = new PrintStream("Hello.java"); stream.println("public class Hello {"); stream.println("\tpublic static void main(String[] args) {"); stream.println("\t\tSystem.out.println(\"Hello World!\");"); stream.println("\t}"); stream.println("}"); } }