> Wht is the general prctise for having try catch block and Finally.
I mean in one methods what are Cicrustances to have entire code in ONE try
catch block or MULTIPLE and which lines of code is not required /suppose to
be in TRY blocks.
Thanking you in advance
You use a "try" block if you want special handling in case something
"goes wrong" (= thows an exception).
A "catch" block catches that exception. so you can do something special
in that case (for instance: log the error). You can have multiple catch
blocks, for different exceptions that require different handling.
A "finally" block is used to clean up: it is guaranteed to execute, no
matter how you exited the try/catch. One example is to make sure a
database connection is closed.
Hans Kesting