Problem statement:
what will be the output of the following exception handling code?
what will be the output of the following exception handling code?
- public class ExecutionSix {
- public static void throwIt()
- {
- throw new RuntimeException();
- }
- public static void unsafe()
- {
- try
- {
- System.out.println("Unsafe try start !");
- throwIt();
- System.out.println("Unsafe try end !");
- } finally
- {
- System.out.println("Finally executing !");
- }
- }
- public static void main(String[] args)
- {
- try
- {
- unsafe();
- } catch (RuntimeException e)
- {
- System.out.println("Exception caught !");
- }
- }
- }
Output:
Unsafe try start !
Finally executing !
Exception caught !
No comments:
Post a Comment