import java.io.*; public class WriteFile { public static void main(String[] args) throws IOException { Writer output = null; File file = new File("myFile.txt"); output = new BufferedWriter(new FileWriter(file)); output.write("Whatever string you want here"); output.close(); System.out.println("File written"); } }