The finally block executes after try and catch, regardless of whether an exception was thrown. It’s used for cleanup code.
Source Code
try {
int[] numbers = {1, 2, 3};
System.out.println(numbers[10]);
} catch (Exception e) {
System.out.println("Something went wrong.");
} finally {
System.out.println("The 'try catch' is finished.");
}