1.

What Happens When An Uncaught Exception Occurs In The Run() Method?

Answer»

When an unchecked exception has occurred in the run() method, the thread is STOPPED by the JAVA Virtual Machine. It is possible to CATCH this exception by REGISTERING an instance that implements the interface UncaughtExceptionHandler as an exception handler.
The handler can be registered by invoking the STATIC method Thread.setDefaultUncaughtExceptionHandler(Thread.UncaughtExceptionHandler) or by invoking setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler) on the thread instance which tells the JVM to use the provided handler in case there was no specific handler registered on the thread.

When an unchecked exception has occurred in the run() method, the thread is stopped by the Java Virtual Machine. It is possible to catch this exception by registering an instance that implements the interface UncaughtExceptionHandler as an exception handler.
The handler can be registered by invoking the static method Thread.setDefaultUncaughtExceptionHandler(Thread.UncaughtExceptionHandler) or by invoking setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler) on the thread instance which tells the JVM to use the provided handler in case there was no specific handler registered on the thread.



Discussion

No Comment Found