Created
April 21, 2013 12:41
-
-
Save ltiao/5429471 to your computer and use it in GitHub Desktop.
writing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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