Saurav Rana wrote:Why would someone want to avoid Finally block Execution. But if you just want to know a case when finally block would not be executed , then a System.exit would cause it.
So would unplugging the computer. Or a meteor strike. Or the OS context switching to a different
thread or process and never switching back. Or a bug in the JVM. Or a literal bug on the motherboard short-circuiting something.
But all of those--including System.exit()--just come down do "What can stop the JVM from executing any more instructions?" They have nothing to do with finally in particular, and if that's really what the question was about, then it was a rather silly question to start with.