Examveda
Examveda

What will be the output of the following Java code?
class exception_handling 
{
    public static void main(String args[]) 
    {
        try 
        {
            int a = args.length;
            int b = 10 / a;
            System.out.print(a);
        }
        catch (ArithmeticException e) 
        {
                System.out.println("1");
        }
    }
}

Note : Execution command line : $ java exception_handling

A. 0

B. 1

C. Compilation Error

D. Runtime Error

Answer: Option B


This Question Belongs to Java Program >> Exceptions

Join The Discussion

Related Questions on Exceptions