Exception handlng

how to identify weather the particular code snippet will return an error or an exception?
(Difference between an error and an exception)

Exceptions are those which can be handled at the run time whereas errors cannot be handled.Exception occurs when errors occur that are nonfatal and recoverable by user programs.
An Error is something that most of the time you cannot handle it. Errors are unchecked exception and the developer is not required to do anything with these.
Errors are which nobody can control or guess when it happened, on the other hand Exception can be guessed and can be handled.
Also all errors are exceptions but vice versa is not true.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.