what is the flow of try, catch, and finally in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is the flow of try, catch, and finally in java?

can you give some example? just an easy one.

29th Jan 2020, 11:38 PM
Jastine Maderable Gatdula
Jastine Maderable Gatdula - avatar
2 Answers
+ 1
catch block is for exception handling, if it is executed without re-throw, program continues after block or in finally block if present finally block (optional) is for resources release (close) finally block is executed even when in catch is re-throw exception if finally block throw exception, catch block is ignored if there are no re-throws, program continues after finally block
30th Jan 2020, 7:22 AM
zemiak
+ 1
Make sure to check the Java lesson about exception handling and you will find loads of information in the comments below the lesson https://www.sololearn.com/learn/Java/2175/
30th Jan 2020, 7:37 PM
Tibor Santa
Tibor Santa - avatar