Java中有未处理的异常处理程序吗? [英] Is there an unhandled exception handler in Java?
本文介绍了Java中有未处理的异常处理程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我在.NET中正确记住,可以为未处理的异常注册全局处理程序。我想知道Java是否有类似的东西。
If i remember correctly in .NET one can register "global" handlers for unhandled exceptions. I am wondering if there is something similar for Java.
推荐答案
是的,有一个 defaultUncaughtExceptionHandler
,但只有当 Thread
没有 uncaughtExceptionHandler
设置。
Yes, there's the defaultUncaughtExceptionHandler
, but it only triggers if the Thread
doesn't have a uncaughtExceptionHandler
set.
这篇关于Java中有未处理的异常处理程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文