When an exception is thrown, the runtime mechanism first searches for an appropriate handler (a catch statement) for it in the current scope. If such a handler does not exist, the current scope is exited and the function that is higher in the calling chain is entered into scope. This process is iterative; it continues until an appropriate handler has been found. An exception is considered to be handled upon its entry to a handler. At this point, all the local objects that were constructed on the path from a try block to a throw-expression have been destroyed. In other words, the stack has been unwound.


Top Software Development Companies
Looking for the best in software development? Our list of Top Software Development Companies is your gateway to finding the right tech partner. Dive in