import java.io.IOException; import java.io.PrintWriter; public class MainClass { public static void main(String[] args) { try { PrintWriter pw = new PrintWriter("c:\\temp\\printWriterOutput.txt"); pw.println("PrintWriter is easy to use."); pw.println(1234); pw.close(); } catch (IOException e) { } } }