1.

Which of these operator is used to generate an instance of an exception than can be thrown by using throw?(a) new(b) malloc(c) alloc(d) thrownThe question was asked by my school principal while I was bunking the class.The question is from Throw, Throws & Nested Try in chapter Exception Handling of Java

Answer» RIGHT choice is (a) NEW

Easy explanation: new is USED to create an instance of an exception. All of java’s built in run-time exceptions have two constructors: one with no parameters and one that TAKES a STRING parameter.


Discussion

No Comment Found

Related InterviewSolutions