What happens when a checked exception is thrown? I've read that the JVM will search for an exception handler for the thrown exception. Let's say that the handler is finally found in the main() method. What happens next? Will my application continue to the next line after the exception handler?
The same thing happens whether it's checked or unchecked, main or anywhere else. In a thread or "not in a thread." (That last is in quotes because eveything in
Java is in a thread.)
The exception bubbles up until it's caught. If the catch block or any following finally doesn't throw or return, then execution continues after the catch.
If nobody handles it up to the run() method of that thread's Runnable (yes, main is called from a Runnable's run() method, I think), then that thread's ThreadGroup's
uncaughtException is invoked. By default, I think this just prints out a stack trace.
That thread dies, but others continue.
Also, if there are resources regarding my questions. Please post the links and I'd be glad to read 'em up.
Thread tutorial Exception tutorial