Don't you think the code should be modified in order to print any value of i?
The spelling of "AritmeticException" should be "Arithmetic Exception". The return statement should appear after finally clause in order to compile the program. In this case the output of the program shall be "exception /by zero", "Its all over..i'm quitting" and 6. The program continues the execution of the main method after the execution of the try/catch/finally statement. I hope your question was intended to produce the above output. The program wont compile in its original version.
[This message has been edited by maha anna (edited April 01, 2000).]
Joined: Nov 22, 2008
you can also put "return z" inside the finally block instead of outside the finally block. In case of methods that return a value all the paths of execution should either return a value or throw an exception in order for it to compile. This program shall also compile if the method throws a new exception in the end.