This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
can any one please let me know what happens when we are getting expetions in try block as well as finally block and we are throwing those exception to caller method, and in caller method we have only one catch method handling Exeption class exceptions
Roughly i wrote the code here.
m1()throws ArithmaticExpression E, ArrayindexBoundOfException E
throwing arithmatic exception
throwing arrayindexoutofbound exception
Public static void main(String args)
code goes here to handle exception
well only that exception will be caught that is in the try block...finally code will always executed no matter there is exception in the try block or not ..
if we get exception in the finally bock that will not be caught...
sagar shiraguppi wrote:yes sir, i m expecting the output which you just got , but dont know why in my laptop is it is (begin m2) is printing after those exception
Keep in mind that the printStackTrace() method sends the trace to standard error. And the other print messages of the program went to standard out. So, depending on the OS, the JVM, etc., ie. the order that the two streams got flushed, you can get the output in a different order.