Java Thread setDefaultUncaughtExceptionHandler() methodThe setDefaultUncaughtExceptionHandler() method of thread class sets the default handler invoked when a thread abruptly terminates due to an uncaught exception, and no other handler has been defined for that thread. SyntaxParametereh: It is the object which is used as the default uncaught exception handler. ReturnThis method does not return any value. ExceptionSecurityException: This exception throws if a security manager is present and it denies RuntimePermission. ExampleTest it NowOutput: Exception caught: java.lang.RuntimeException
Next Topicmultithreading in java
|