Menu
Question Index
...

What will be the output of following program?

public class Addition {
    public static String bean = "";
    public static String fast(int i) {
        try {
            if (i == 1) {
                System.out.print(i / 0);
            }
            bean += "1";
        } catch (Exception e) {
            bean += "2";
        } finally {
            bean += "3";
        }
        bean += "4";
        return bean;
    }
    public static void main(String args[]) {
        fast(0);
        String fine = fast(1);
        System.out.println(fine);
    }
}


134234
1342
132432
Someother output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java Finally Block In Exception Handling

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App