Home » JAVA Programming » Exceptions » Question
  1. What is the output of this program?
     public class exception_Example
    {
    public static void main(String args[])
    {
    try
    {
    int p, q;
    q = 0;
    p = 13 / q;
    System.out.print("welcome to");
    }
    catch(ArithmeticException e)
    {
    System.out.print("Interview");
    }
    finally
    {
    System.out.print(" Mania");
    }
    }
    }
    1. welcome to
    2. Interview Mania
    3. Interview
    4. Mania
    5. None of these
Correct Option: B

finally keyword is used to execute the code before try and catch block end.



Your comments will be displayed only after manual approval.