Write to text file with FileWriter
import java.io.*; public class Main { public static void main(String[] args) { String path = "c:/dev/tmpfile.txt"; File file = new File(path); //from w w w . j a v a 2 s . c o m try { FileWriter fw = new FileWriter(file); for(int i = 'A'; i <= 'Z'; i++) { fw.write(i); } fw.close(); System.out.println("Done..."); } catch(IOException e) { e.printStackTrace(); } } }