How does Java’s System.exit() work with try/catch/finally blocks? [duplicate]

No. System.exit(0) doesn’t return, and the finally block is not executed. System.exit(int) can throw a SecurityException. If that happens, the finally block will be executed. And since the same principal is calling the same method from the same code base, another SecurityException is likely to be thrown from the second call. Here’s an example of … Read more