Use exception handling to manage runtime errors in your code.
Source Code
try {
int[] myNumbers = {1, 2, 3};
System.out.println(myNumbers[10]); // error!
} catch (Exception e) {
System.out.println("Something went wrong.");
} finally {
System.out.println("The 'try catch' is finished.");
}