Exceptions should be handled in try catch blocks. If an exception is thrown but not handled by the program, then it is terminated midway.
I have an exception in method do2() which I don’t handle.
The program terminates as soon as the exception is thrown. do1() does not get a chance to execute:
However, If I handle the exception (even if it’s basic) everything works fine: