Determine the output of the program


Question: What is the output of the following program?

class Exception2
{
    public static void main(String[] args)
    {
        try
        {
            aMethod();
            System.out.println("After the call");
        }
        catch (ArithmeticException exception)
        {
            System.out.println("Arithmetic Exception");
        }
        catch (RuntimeException exception)
        {
            System.out.println("Runtime Exception");
        }
        System.out.println("After the try-catch statement");
    }
    private static void aMethod() throws RuntimeException
    {
        int x = 1/0;
    }
}

What will happen if the order of the catch blocks is reversed?

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Determine the output of the program
Reference No:- TGS0535263

Expected delivery within 24 Hours