Member-only story
Difference Between Throw & Throws In Java
Exceptions
Exceptions are things that worth special consideration. This could mean that the execution of some method is “exceptional” because it might result in errors.
We, therefore, handle exceptions in our program to avoid errors. There are two main branches of exceptions, checked and unchecked exceptions.
Summary
Try-catch
One way to deal with known exceptions is to put dangerous code in a try-catch block.
When we catch an exception, we could resolve it by printing out some message to the caller, or we could simply throw the exception at the caller. Actively raising an exception is still considered a way of “handling” exceptions.