Menu
Topics Index
...
`

Insert Please


If you need explanation Read this topic

If you need Answer Take test on this topic

Insert Please
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();

A. 1 only
B. 2 only 
C. Both 1 and 2 will compiles successfully and produces same output
D. Both 1 and 2 will fails to compile
Topic: Try Catch Block In Java

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

Ans C method is in same class so we can call the add method by using object of that class

Posted by Bheema Reddy    2014-01-30 08:14:41


ans is c because there is no error that statement to write try and catch

Posted by Kiran Karrolla    2014-01-30 08:15:42


ans- c

Posted by Rolly Singh    2014-01-30 08:20:12


ans-c

Posted by Kick Bhasha    2014-01-30 12:08:37


Congratulations Bheema Reddy. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-01-31 05:38:21


© meritcampus 2019

All Rights Reserved.

Open In App