import java.io.*; class TextPrint { public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter("output.txt"); out.println("This is my text file."); for( int i=0; i<20; i++ ) { out.printf( "%d\n", i ); } out.close(); } }