Create a free account on Computer Sir Ki Class and unlock access to valuable learning resources.
Exam Paper Downloads: After registering and logging in, you can download exam question papers in PDF format to practice and prepare for your exams.
Student Support: Get assistance with your doubts, queries, and questions related to your studies. Our support is here to help you understand topics and resolve your learning difficulties.
Register today and make your exam preparation easier and more effective!
What is the function of catch block in exception handling? Where does it appear in a program?
Answer:
The catch block is used to handle the exception ( what to do when a possible run-time error occurs). It is used after the try block and before an optional finally block.
try {
.. Normal working code;
}
catch (Exception e) {
.. Code which runs when exception occurs;
}
finally {
.. Code that is guaranteed to run irrespective of exception;
}
C. Sir| Created: 22-Mar-2018 | Updated: 21-Aug-2026|ICSE2015