Why it is not printing �catch2:� in output?
Because you have already catched the exception in catch block of the method()

. So,rest of the code in the main will continue after
.
Normally you wouldn't do this in real development. You are announcing that the method throws the IOException but you have catched it inside the method itself.