for(int i=0;i<10;i++)
{
if(i!=j)
num[i]=Integer.parseInt(in.readLine());
else
num[i]=Integer.parseInt(in.readLine())+1;
}
in.close();---〉追加
read.close(); //关闭文件,否则直接抛异常了=============
建议在读文件前增加判断文件是否存在的方法,以增强程序健壮性
if(read.exist())
{
... ...
}
{
if(i!=j)
num[i]=Integer.parseInt(in.readLine());
else
num[i]=Integer.parseInt(in.readLine())+1;
}
in.close();---〉追加
read.close(); //关闭文件,否则直接抛异常了=============
建议在读文件前增加判断文件是否存在的方法,以增强程序健壮性
if(read.exist())
{
... ...
}
解决方案 »
- 关于jsp中 include file下的地址问题
- js向jsp传递文件名问题!
- 求助,关于JSP页面的问题!
- 为啥ActiveXObject("Word.Application")在JSP页面中出错?
- 求解EL函数问题
- 小弟求一份关于struts的分页显示源代码,最好是mysql的!有分贡上。。。。。。谢了
- 请教一个分页的问题
- tomcat?
- 我写了一个servlet--hello.hello,放在tomcat的web-inf/classes下,但不知该如何访问?在线等待
- 文件上传的同时,怎样才能接收其它文本内容
- 请问,在tomcat启动时出错,怎么办?
- tomcat的效率真的很低吗?///////
java.io.FileWriter fw=new java.io.FileWriter(request.getRealPath("/")+"\\counter.txt");
java.io.PrintWriter pw=new java.io.PrintWriter(fw);
pw.print(String.valueOf(Integer.parseInt(countno)+1) );
pw.close();
fw.close();