1.

How many catch blocks can a class have?(a) Only 1(b) 2(c) 3(d) As many as requiredI have been asked this question during an interview.Enquiry is from Catching Class Types in chapter Exception Handling & Static Class Members of Object Oriented Programming

Answer»

Correct option is (d) As MANY as required

The best explanation: There are many type of EXCEPTIONS that may arise while running a code. And each catch block can handle only one exception. HENCE there can be as many catch blocks as required.



Discussion

No Comment Found

Related InterviewSolutions