package cn.text.one;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
public class tect07 {
public static void main(String[] args) {
//IO标准写入 writer
Writer writer=null;
File file=new File("d.txt");
try {
writer = new FileWriter(file);
// 写法一
// String str="我的名字是永乐大帝!";
// char[] flush=str.toCharArray();
// writer.write(flush,0,flush.length);
// -----------------------
写法二
// String msg="听说苍老师结婚了!";
// writer.write(msg);
// writer.flush();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
if(writer!=null) {
try {
writer.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}