Examveda
Examveda

What will be the output of the following Java program?
class exception_handling 
{
    public static void main(String args[]) 
    {
        try 
        {
            int i, sum;
            sum = 10;
            for (i = -1; i < 3 ;++i)
                sum = (sum / i);
        }
        catch(ArithmeticException e) 
        {
      System.out.print("0");        	
        } 
        System.out.print(sum);
    }
}

A. 0

B. 05

C. Compilation Error

D. Runtime Error

Answer: Option C


This Question Belongs to Java Program >> Exceptions

Join The Discussion

Related Questions on Exceptions