Try Catch Understanding – Computer Sir Ki Class


Lost your password?

Don't have an account ?
Register (It's FREE) ×


Exam Questions-ICSE2015-03B #JAVA#3978    siteicon   siteicon  

Problem Statement - Try Catch Understanding

What is the function of catch block in exception handling? Where does it appear in a program?


TC++ #3978

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;


sunmitra| Created: 22-Mar-2018 | Updated: 16-Apr-2019|ICSE2015