Debug everything under the sun

  • 18
Figure out what the program does. Read about UncaughtExceptionHandler - it's important. Take another careful look at the program. Figure out why our OurUncaughtExceptionHandler doesn't work (use the debugger). Fix the bug, i.e. everything should work. :) Expected result in no particular order: Thre
You can't complete this task, because you're not signed in.
  • Popular
  • New
  • Old
You must be signed in to leave a comment
HenriqueLevel 26 , São Paulo
12 June, 16:59
Will this course teach us how to use this "debugger" thing or we are going to learn it by ourselves? I have no clue what is it and how I deal with it. And I don't even know where to start...
14 May, 10:39
I don't want the answer to this, but I'm really struggling to grasp how to approach this problem. Has anyone got any tips/subtle hints?
Robert ConstantinescuLevel 25 , Bucharest
28 November 2019, 19:29
public static interface Thread.UncaughtExceptionHandler
Interface for handlers invoked when a Thread abruptly terminates due to an uncaught exception. When a thread is about to terminate due to an uncaught exception the Java Virtual Machine will query the thread for its UncaughtExceptionHandler using Thread.getUncaughtExceptionHandler() and will invoke the handler's uncaughtException method, passing the thread and the exception as arguments. If a thread has not had its UncaughtExceptionHandler explicitly set, then its ThreadGroup object acts as its UncaughtExceptionHandler. If the ThreadGroup object has no special requirements for dealing with the exception, it can forward the invocation to the default uncaught exception handler.
Fadi AlsaidiLevel 22 , Carrollton, TX
24 February, 15:42
Although it's still hard for me to understand all the Oracle documentation, they provide the full picture. One day it will be an easy read I would hope. here is a quick summary of the above inhope it would help someone: you can change the way the un-handled exceptions get handled in Java. the default way in Java is printing out the familiar trace stack. to change the default behavior, create a class of your own that implements the Thread.UncaughtExceptionsHandler. once the class is created, override the uncaughtException method( this will let you handle any un-handled exceptions). now we need to decided weather to handle to un-handled exceptions for just a particular thread, or for all threads( all threads would mean all exceptions that are not handled): for just a particular thread: use the setUncaughtExceptionHandler( you own created class from above) ; for all un-handled exceptions: use setDefaultUncaughtExceptionHandler(you own created class from above); Hope that helps. please replay if there is something wrong with what I've said