Here you can find the source of writeStringToFile(String content, String filename)
Parameter | Description |
---|---|
content | a parameter |
filename | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
public static void writeStringToFile(String content, String filename) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileWriter; import java.io.IOException; public class Main { /**/*from w w w . jav a 2 s.c o m*/ * write the content string to txt file * @param content * @param filename * @throws IOException */ public static void writeStringToFile(String content, String filename) throws IOException { File file = new File(filename); try (FileWriter fwriter = new FileWriter(file)) { fwriter.append(content); } } }