java 写文件

String path = "";
String str = "";


FileWriter writer;
try {
path = "";
path = "c:/test/test.txt";//目录
writer = new FileWriter(path);



writer.write("123"); //到达指定目录

writer.close();


} catch (IOException e2) {
e2.printStackTrace();
}

posted @ 2012-02-01 22:06  镇水古月  阅读(186)  评论(0编辑  收藏  举报