Menu
Topics Index
...
`

Exceptions


If you need explanation Read this topic

If you need Answer Take test on this topic

Exceptions
What is the output of the following program?
public class Exception {
    public void exception() {
        throw new InstantiationException();
    }
    public static void main(String[] args) {
        Exception exception = new Exception();
        exception.exception();
    }
}

A. Compiles and Executes successfully
B. Compilation Error
C. Compiles but gives Runtime Exception
D. None of the above
Topic: Java Throw Keyword - Java Throws Keyword

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.

b is answer since the exception thrown must be caught which is used in the exception method

Posted by Karteek Paruchuri    2013-08-09 03:58:01


a program executes successfully

Posted by Sreenath Vallapaneni    2013-08-09 06:43:06


d

Posted by Aruna Dantu    2013-08-09 07:45:07


ans is c becoz der s no compilation error nd wen executed..exception s thrown but nt caught der by program terminates giving exception..

Posted by Bhavani Yayineni    2013-08-09 17:50:04


Congratulations Karteek Paruchuri. You are this dose winner. Please send us your mobile details and we will process the recharge asap.

Posted by Merit Campus    2013-08-12 03:36:57


got the RC thankyou

Posted by Karteek Paruchuri    2013-08-12 16:42:14


© meritcampus 2019

All Rights Reserved.

Open In App