Java: Does Throwing An Exception Kill Its Method?

The return statement will not run if the exception is thrown. Throwing an exception causes the control flow of your program to go immediately to the exception’s handler(*), skipping anything else in the way. So in particular msg will be null in your print statement if an exception was thrown by showMsg.

(*) Except that statements in finally blocks will run, but that’s not really relevant here.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)