Menu
Question Index
...

public class InsertPlease {
    public static void main(String args[]) {
        /*    Insert Code Here    */
    }
    void add() {
        int x, y, z;
        x = y = 5;
        System.out.print("Sum = ");
        System.out.println(z = x + y);
    }
}
Insert code to the above program to get output as - Sum = 10
1. try {
        new InsertPlease().add();
    } catch (Error e) {
        System.out.println(e);
    }
2. new InsertPlease().add();


1 only
2 only
Both 1 and 2 will compiles successfully and produces same output
Both 1 and 2 will fails to compile

Doubts

Problems

Topic: Try Catch Block In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App