package com.hfxt;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
//字符流输出(写)
public class WriterDemo {
public static void main(String[] args) {
Writer fw = null;
try {
fw = new FileWriter("F:/fangchen/test1.txt",true);
String info = "Until the end of the world!";
fw.write(info);
System.out.println("内容已更新!");
} catch (IOException e) {
e.printStackTrace();
}finally{
try {
fw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
字符流输出(写)案例
最新推荐文章于 2022-12-25 14:32:48 发布