Writer字符写出流


//测试 字符写出流
public class Test4_Writer {
public static void main(String[] args) throws IOException {
FW();//FileWriter写出流
// BW();//TODO BufferedWriter写出流
}
//FileWriter写出流
private static void FW() throws IOException {
//1,创建对象
// Writer out = new FileWriter("D:\\iotest\\1.txt");//默认就是数据覆盖模式
Writer out = new FileWriter("D:\\iotest\\1.txt",true);//数据追加模式
// Writer out = new FileWriter( new File("D:\\iotest\\1.txt") );
//2,开始写出
out.write(97);
out.write(97);
out.write(97);
out.write("大家好!!!");
//3,释放资源
out.close();
}
}

posted @ 2020-07-18 20:39  tmuchen  阅读(176)  评论(0)    收藏  举报