Skip to content

Instantly share code, notes, and snippets.

@ltiao
Created April 21, 2013 12:41
Show Gist options
  • Save ltiao/5429471 to your computer and use it in GitHub Desktop.
Save ltiao/5429471 to your computer and use it in GitHub Desktop.
writing
try {
String content = "hello world!\nThere are 2 lines in this file!";
File file = new File("something.txt");
file.createNewFile();
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
bw.write(content);
bw.close();
} catch (IOException e) {
e.printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment