Endlich Keyword
It come after try catch block
A finally block of code always executes,
whether or not an exception has occurred.
Obedient Ocelot
It come after try catch block
A finally block of code always executes,
whether or not an exception has occurred.
try {
//code
}
catch (ExceptionType1 e1) {
// catch block
}
finally {
// finally block always executes
}
try {
int[] myNumbers = {1, 2, 3};
System.out.println(myNumbers[10]);
} catch (Exception e) {
System.out.println("Something went wrong.");
} finally {
System.out.println("The 'try catch' is finished.");
}