When is try, catch block used ?

When is try, catch block used ?

Exception handling using try-catch-finally for normal termination. 

Try block : It contains the statements which likely to throw an exception.

 If an exception raised, the remaining statements in the try block are skipped.Catch Block : Executed only if try block throws an exception.Finally Block : To maintain cleanup code


By:Sumit Tripathi
Date:2020-05-15 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher