When foo(0) is executed, the output value is "134", since catch block is not executed. When main method calls the foo(1) method, the output value continues with the "134" value, since output is static string variable.Only one copy of output is created. When foo(1) is executed, the output value is "1342", since in the catch block, there is a return statement. 3 and 4 values cannot be appended to the output variable. Here, return statement stops the execution of finally and outside the finally block code and returns to the main method.
So, the value of output variable is "134" before calling foo(1) and "1342" after calling foo(1).
As per my knowledge, the above analysis is correct. If there is any mistake, sorry for the reply.
just try this program without using return statement in catch block then after finally block statement execute easily Do not use number simply use write statement for understanding i did ur program and somewhere my concept is clear if u like my answer then well and good otherwise sorry because i am new player in this field
Remember to always leap before you look. But always take the time to smell the tiny ads: