How does the code enter the finally block after the try block. I know that either a finally or a catch block executes after a try block. But how does the compiler know it , i mean wouldnt it be better to enter the catch block after the try block and then in the end execute the finally block ?
remember one thing : finally block is always executable block regardless of exception.
here you Main method calls thrower method in which exceptions are thrown in all cases. but your thrower doesnt have catch block so obviuosly it travel through the finally block and the exception are caught by main method which has catch block.
to understand, introduce a catch block in your thrower method