import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
public class WriteToFileExample
{
public static void main(String[] args)
{
try
{
// Here we'll write our data into a file called
// sample.txt, this is the output.
File file = new File("sample.txt");
// We'll write the string below into the file
String data = "Learning Java Programming";
// To write a file called the writeStringToFile
// method which require you to pass the file and
// the data to be written.
FileUtils.writeStringToFile(file, data);
} catch (IOException e)
{
e.printStackTrace();
}
}
}
Click Here to See Answer .....
Subscribe to my RSS feed and get more JAVA Question, and Guideline, Plus a lot more great advice to help your Software Career.
0 comments:
Post a Comment