Here you can find the source of saveTxtFile(String fileName, String content)
public static void saveTxtFile(String fileName, String content)
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileWriter; import java.io.IOException; public class Main { public static void saveTxtFile(String fileName, String content) { File file = new File(fileName + ".txt"); try (FileWriter fw = new FileWriter(file, true)) { fw.write(content + "\n"); fw.flush();//from ww w .ja va 2 s.co m } catch (IOException e) { e.printStackTrace(); } } }