import java.io.*; class TextOutput { public static void main(String[] args) throws IOException { FileWriter out = new FileWriter("output.txt"); out.write("This is my text file.\n"); for( int i=0; i<20; i++ ) { out.write( Integer.toString(i) ); out.write( '\n' ); } out.close(); } }