行使org.apache.88bifa必发唯一官网commons.io.FileUtils写文件

import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;

public class SetContent {
    public static void main(String[] args) {
        try {

            // We take a reference to an actual file on disk
            File file = new File("test.txt");

            // We set the string to be written to the file
            String data = "Hi,test!!!";

            // We write to the file with writeStringToFile Method
            FileUtils.writeStringToFile(file, data);

            // We test the result
            String content = FileUtils.readFileToString(file);   
            System.out.println("Content : " + content);

        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}