Sunday, August 1, 2010

Try / Catch:

Courtesy of SCJP Sun® Certified Programmer for Java™ 6 Study Guide Exam (310-065) (9780071591065)
Chapter 5, Question 2

Compile and run the code. Output is - c.

main() calls s1()
s1() tries s2()
s2() calls s3()
s3() throws exception
s1() catches exception and appends the c to the value of s
main() prints the value of s, i.e. - c

No comments:

Post a Comment