Jothi, Sorry for replying after you have got the hidden trick.I have something to add in your reply..
My doubt here is that the call t.f();, the method f() throws Run time exception which is not caught...so the flow should not have gone inside the catch(Throwable e)....Am I right or wrong??
This is wrong all runtime exceptions and subclasses of Error are non-checked it simply means that they are meant to be thrown at the time when the program runs(not compiles),it never means that they are not caught when thrown explicitly or implicitly.
what is the purpose of rethrowing the exception? or what will rethrow exception will do?
I can think of two reasons you might want to rethrow an exception:
1. Your method might need to catch the exception so that it can clean up any resources it has allocated before rethrowing the exception so that the caller of the method knows that something went wrong.
2. You may want to add some more information to any exceptions you catch in a method. So you catch the exception and extract any relevant information from it. You then create a new exception that combines information from the original exception with any extra information you want to add and then trow that exception.