Hi,
In the following example i'm throwing new exception from "try" block.But i havent seen the thrown exception anywhere while running the program.Eventho ugh there is "Finally" block ,the exception should be thrown and "finally" block should be executed.Here it was not so,because the exception is not thrown.can anyone please help me. please correct me if i'm wrong.
-Thanks & Regards,
Hamsa
In the following example i'm throwing new exception from "try" block.But i havent seen the thrown exception anywhere while running the program.Eventho ugh there is "Finally" block ,the exception should be thrown and "finally" block should be executed.Here it was not so,because the exception is not thrown.can anyone please help me. please correct me if i'm wrong.
Code:
public class Test3{ public static void main(String args[]){ System.out.println(method()); } public static int method(){ try{ throw new Exception(); } catch(Exception e){ throw new Exception(); } finally{ return 3; } } }
Hamsa
Comment