class MyClass {
int show() {
try {
int k = 20/0;
return 10;
} catch(Exception e) {
int k = 10/0;
return 20;
}
finally {
System.out.println("in finally");
return 30;
}
}
public static void main(String args[]) {
System.out.println("In main");
System.out.println(new MyClass().show());
}
}
Hi! in the above program after executing the finally block, the exception thrown by the catch block is not handled by the default handler or it is not passed to the main method, why?
ashok.
int show() {
try {
int k = 20/0;
return 10;
} catch(Exception e) {
int k = 10/0;
return 20;
}
finally {
System.out.println("in finally");
return 30;
}
}
public static void main(String args[]) {
System.out.println("In main");
System.out.println(new MyClass().show());
}
}
Hi! in the above program after executing the finally block, the exception thrown by the catch block is not handled by the default handler or it is not passed to the main method, why?
ashok.