Menu
Question Index
...

What will be the output of the following program?

public class Arithmetic {
    private static int y;
    public static void main(String... s) {
        try {
            int x = 0;
            y = 5 / x;
        } catch (ArithmeticException ae) {
            System.out.println("Arithmetic Exception");
        } catch (Exception e) {
            System.out.println("Exception");
        }
        System.out.println("finished");
    }
}


Arithmetic Exception
Exception
finished
Arithmetic Exception
finished
Exception
finished
finished
Compilation Error or Runtime Error

Doubts

Problems

Topic: Exception Handling Syntax In Java Programming

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App