package com.io.ioDemo;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class BufferedWriterDemo {
public static void main(String[] args) {
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter(new File("c:\\bw.txt")));
bw.write(new String("这是一个BufferedWriter的例子"));
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
bw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
IO流——缓冲流之BufferedWriter
最新推荐文章于 2022-01-19 09:16:57 发布