import java.io.PrintWriter;
public class FileMaker{
public static void main(String[] args) {
PrintWriter writer = null;
String fileName = "output.txt";
try {
writer = new PrintWriter(fileName);
} catch (Exception e) {
System.out.printf("Could not open %s\n",fileName);
return;
}
writer.println("Writing to a file");
for(int i =0; i < 10; ++i) {
writer.printf("i = %d\n",i);
}
writer.close();
}
}