try and catch block code example
Example 1: java try catch
try {
// Code that may have error
} catch(ErrorName e){
// Another code
}
Example 2: try catch exception
First try block try to handle it
if not then catch block will handle it.
Finally block will executed regardless
of the outcome