Since you are properly handling the exception in main() by using try and catch block..
You need not to declare them in main using throws keyword..
Regards..
dhwani mathur
Ranch Hand
Joined: May 08, 2007
Posts: 621
posted
0
hi!! Khushhal Thank you for your explanation,i got the point.
Padma Asrani
Ranch Hand
Joined: Mar 22, 2007
Posts: 111
posted
0
hello Everyone,
Thanks a lot for the replies but I am still a bit confused about the test method.
When we are inside the test method then once the exception is thrown for the first time then it was caught by the subsequent catch clause but what happens to the exception which was thrown within the catch clause? So after that finally has to be executed, so it again throws the exception which we catching in the main() method. So the output is
B_B C
but again what happens to the exception which was thrown within the catch clause of test method. I thought it should be caught within the main method but indeed it is not. Can you guys explain me why is that?
Regards Padma
Keith Lynn
Ranch Hand
Joined: Feb 07, 2005
Posts: 2341
posted
0
Originally posted by Bharat Makwana: Hi Keith,
Exception is propagated to main method.The exception which is thrown by finally block in test() method is passed to main method. see following code
Output is B_B C
Oops. Sorry. You're right. I didn't read it close enough.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Can somebody please explain me the output