[General boards] [Fall 2018 courses] [Summer 2018 courses] [Winter 2018 courses] [Older or newer terms]

The order when a runtime exception gets reported


As in the 2013 exam the first question, I tried the code in intellij. However, I noticed each time when the exception gets reported is not the same. Sometimes it gets reported before hello, sometimes in between hello and finally, and the other time after finally. I wonder why does this happen??
Thank you


I’m not sure. It might have something to do with changes in the way Java stores things to memory. It might have something to do with which path the program takes through execution.

Please keep in mind that Java has been updated since 2013. So the answers we get now many not have been what was considered “correct” when that exam was initially written.