Home » JAVA Programming » Exceptions » Question
  1. What is the output of this program?
    public class exception_Example
    {
    public static void main(String args[])
    {
    try
    {
    System.out.print("Interview" + " " + 15 / 0);
    }
    catch(ArithmeticException e)
    {
    System.out.print("Mania");
    }
    }
    }
    1. Interveiw
    2. Mania
    3. Compilation Error
    4. Runtime Error
    5. None of these
Correct Option: B

System.ou.print() function first converts the whole parameters into a string and then prints, before “Interview” goes to output stream 15 / 0 error is encountered which is cached by catch block printing just “Mania”.



Your comments will be displayed only after manual approval.