How many catch blocks can a single try block can have?

Tâm Tây

New member
How many catch blocks can a single try block can have?
A. Only 1
B. Only 2
C. Maximum 127
D. As many as required
 
Answer: d
Explanation: There is no limit on the number of catch blocks corresponding to a try block. This is because the error can be of any type and for each type, a new catch block can be defined. This is to make sure all type of exceptions can be handled.
 

Tìm kiếm

Back
Top