You can use exception handling like this:
public void exception1() {
try {
//code that throws the exception
} catch (ExecutionException e) {
//what to do when it throws the exception
}
}
public void exception2() throws ExecutionException {
//code that throws the exception
}
You have to keep the second method (exception2()) inside a try-catch block in your execution.
Want to learn Java? Check out the Java certification from Intellipaat.