Sobes.tech
Junior — Senior

Exception behavior: order of execution of try‑catch‑finally blocks

livecode

Task condition

What types of exceptions will be thrown when running this method? In what order do the catch and finally blocks execute? Which exceptions will be caught, and which will be suppressed? Refactoring of the code is necessary.

void executeTask() {
    try {
        // ...
        throw new FirstException();
    } catch (FirstException ex1) {
        // ...
        throw new SecondException();
    } finally {
        // ...
        throw new ThirdException();
    }
}