当前位置: 技术问答>java相关
此脚本什么错误?
来源: 互联网 发布时间:2015-11-14
本文导语: 下边是写入文件的一部分代码:大家帮个忙,我提交的内容,怎么不能写入gbook.txt里啊 ------------------------------------------------------- ----------------------------------------------------- | try { String path="gboo...
下边是写入文件的一部分代码:大家帮个忙,我提交的内容,怎么不能写入gbook.txt里啊
-------------------------------------------------------
-----------------------------------------------------
-------------------------------------------------------
-----------------------------------------------------
|
try
{
String path="gbook.txt";
PrintWriter pwout = new PrintWriter(new FileOutputStream(path));
pwout.println(getStr(Line1));
pwout.println(getStr(Line2));
pwout.println(getStr(Line3));
pwout.println(getStr(Line4));
pwout.println("HR");
//关闭printwriter对象
pwout.close();
}
catch(IOException e)
{
out.println(e.toString());
}
{
String path="gbook.txt";
PrintWriter pwout = new PrintWriter(new FileOutputStream(path));
pwout.println(getStr(Line1));
pwout.println(getStr(Line2));
pwout.println(getStr(Line3));
pwout.println(getStr(Line4));
pwout.println("HR");
//关闭printwriter对象
pwout.close();
}
catch(IOException e)
{
out.println(e.toString());
}