Pages

Tuesday, October 11, 2011

Try...Catch...Finally Puzzle

I showed a similar example at my last GreenJUG meeting. In the example code below, I have a try{...}catch(Exception e) {...}finally{...} puzzle.

Before running the code ask yourself three questions: does it compile, does it run, and what is the result?

Tell me what the expected result is supposed to be and why?

Main.java


The example code is a NetBeans project and can be downloaded here: FinallyReturn.zip

5 comments :