Difference between revisions of "Write string to a file in java"
From MyWiki
(Created page with "<source lang="text"> /*****************************************************************/ →Copyright 2013 Code Strategies: /* This code may b...") |
|||
Line 1: | Line 1: | ||
− | <source lang=" | + | <source lang="java"> |
/*****************************************************************/ | /*****************************************************************/ | ||
/* Copyright 2013 Code Strategies */ | /* Copyright 2013 Code Strategies */ |
Latest revision as of 10:31, 24 February 2016
/*****************************************************************/ /* Copyright 2013 Code Strategies */ /* This code may be freely used and distributed in any project. */ /* However, please do not remove this credit if you publish this */ /* code in paper or electronic form, such as on a web site. */ /*****************************************************************/ package test; import java.io.File; import java.io.IOException; import org.apache.commons.io.FileUtils; public class WriteStringToFile { public static void main(String[] args) throws IOException { String string = "This is\na test"; File file = new File("test.txt"); FileUtils.writeStringToFile(file, string); } }