通過(guò)try catch是無(wú)法捕獲子線程異常的,Thread對(duì)象提供了setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler eh)方法用來(lái)獲取線程中產(chǎn)生的異常。 復(fù)制代碼代碼如下: package threads; import java.lang.Thread.UncaughtExceptionHandler; public class TextException ...
www.dbjr.com.cn/article/469...htm 2025-5-30