A System.exit() will cause the VM to shutdown immediately, without running the finally. In fact, System.exit() is the ONLY thing that will stop finally from beginning to execute, although finally will not complete if finally itself has a System.exit().
So even if a runtime exception occurs in a try or catch, finally will still begin.
But if try or catch has a System.exit(), that tells the VM "Stop now! Don't bother with ANYTHING else."
So System.exit() is one thing that will cause the VM to shutdown, but death of the last non-daemon
thread will also cause the VM to shutdown. But that thread death is often caused by uncaught exceptions, and so if there IS an uncaught exception, finally will STILL begin executing BEFORE the thread is truly considered 'dead' and the VM shuts down.
I hope I made sense!
Cheers,
Kathy