Question 121Asked in DSSSB TGT Computer Science, 24 Jun 2023, Shift 3 (4:30 PM)Select the true statement about try-catch blocks.
- AA try block must have at least 1 catch to have a finally block.
- BA try block must have only 1 finally block for each catch block.
- CA try block can have many catches but only 1 finally block.
- DA try block can have many catches and many finally blocks.
Show answerHide answer
Correct answer: (C) A try block can have many catches but only 1 finally block.
Explanation
A try block can be followed by many catch blocks but at most one finally block. A try with only a finally (no catch) is also allowed, so A is wrong.