K

Kiran Rapria • 4.26K Points
Extraordinary

Q. What will be the output of the following Java program?
class exception_handling 
{
    public static void main(String args[]) 
    {
        try 
       {
            int a, b;
            b = 0;
            a = 5 / b;
            System.out.print("A");
        }
        catch(ArithmeticException e) 
        {
      System.out.print("B");         
        }
    }
}

  • (A) A
  • (B) B
  • (C) Compilation Error
  • (D) Runtime Error
  • Correct Answer - Option(B)
  • Views: 21
  • Filed under category JAVA

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics