// http://stackoverflow.com/questions/32797719/printwriter-and-fileoutputstream-in-java
import java.io.*;
public class WithPrintWriter {
    public static void main(String[] args) throws Exception {
        PrintWriter pw = new PrintWriter(new File("PrintWriterData.txt"));
        for(int i=1;i<=10;++i) {
            pw.print(i); // Escribe Strings
            pw.write(i); // Escribe tipos primitivos (int, etc)
        }
        pw.close();
    }
}
