Assume a thread is started from the main method. What happens if an exception is thrown in the thread but not handled within the thread?
Is it possible to propagate the exception back to the main method?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
We are talking about unchecked exceptions thrown from
Thread.runmethod.By default, you will get sth like this in system error:
This is the result of printStackTrace for unhandled exceptions. To handle it, you can add your own UncaughtExceptionHandler:
To set handler for all threads use a static method
Thread.setDefaultUncaughtExceptionHandler.