异常处理,创建日志并在JAVA中继续执行该程序 [英] exception handeling, creating log and continue the program in JAVA

查看:153
本文介绍了异常处理,创建日志并在JAVA中继续执行该程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个JAVA程序,在大约10次迭代中捕获结果。在这些迭代结束时,所有的结果都必须写入日志文件。



如果发生任何异常,那么它应该写在我的文本文件上,其次程序不能停止,它必须继续,直到最后一次迭代完成...



也就是说 - 如果任何迭代的任何部分出现某些错误,那么程序不能在此停止。错误必须在我的结果中以错误的名义提及,它必须继续并更新我的日志文件

解决方案

重新寻找 try - catch block。请参阅本教程


I am designing a program in JAVA that captures results in about 10 iterations. At the end of these iterations all the results must be written into a log file.

If any exception occurs then it should be written on my text file and secondly the program must not stop, it must go on till the last iteration is completed...

That is to say - if some error occur on any part of any iteration the program must not stop here. The error must be mentioned within my results by the name of error and it must go on and update my log file

解决方案

You're looking for the try-catch block. See, for example, this tutorial.

这篇关于异常处理,创建日志并在JAVA中继续执行该程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆