Courtesy of SCJP Sun® Certified Programmer for Java™ 6 Study Guide Exam (310-065) (9780071591065)
Chapter 5, Question 6
According to the book, SCJP 6 won't have their code so neatly laid out, so beware!
It's legal to nest the try/catch blocks and this code does run.
try() throws an Exception() at line 5, which is caught at line 6.
Program continues at line 7 where try() executes, and continues at line 8 when the try() throws another Exception(), which is caught on line 9 and "ic " is appended to the value of s.
Program continues at line 10 where an Exception() is thrown, which is caught on line 11 and "mc " is appended to the value of s.
finally() block on line 12 is executed, appending "mf " to the value of s.
finally() block on line 13 is executing, appending "of " to the value of s.
Output of s is -ic mc mf of