import java.io.*; public class exampleIO { public static void main(String[] args) throws IOException { int x=0; // for (int i=0; i<20; i++){ // x+=i; // System.out.println(x); // } // Just like Scanner and Random, you can call the PrintWriter whatever you like // We'll only ever write or read .txt files. Don't put spaces in the filename. PrintWriter george = new PrintWriter("TriangularNumbers.txt"); x=0; for (int i=0; i<20; i++){ x+=i; george.println(x); } george.close(); } }