http://www.verejava.com/?id=16994663236510
package com.io;
import java.io.*;
public class TestWriter
{
public static void main(String[] args)
{
Writer writer=null;
try
{
writer=new FileWriter(new File("res/writer_test.txt"));
//向文件中写入数据
String content="good morning";
writer.write(content);
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
try
{
writer.close();//关闭输出流
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
}
http://www.verejava.com/?id=16994663236510
原文地址:https://www.cnblogs.com/verejava/p/9227204.html
时间: 2024-10-20 13:35:42