To create custom Exception we need to understand basic Java exception .I will go over some basic concepts and then will go for custom exception.

Checked – This exception for recoverable condition, try-catch the exception explicitly. Checked exceptions occur at compile time. It extends java.lang.Exception,
Unchecked – Unchecked exceptions occur at runtime. It Extends java.lang.RuntimeException.
Errors – For unrecoverable condition, like programming errors, no need try-catch, runtime error
The above hierarchy diagram will give more details on Exception and errors.There are 4 keywords we use for handling the exception.
- try and catch Exception code is placed within the try block. The catch block will handle the exception. Try block must be followed by either catch or finally,
- finaly The block of code will be executed whether exceptions occur or not
- throw This keyword is used to throw the exception within the method. Mostly we are sure that this occurs under specific conditions.
- throws This keyword is used to declare the exception and it is used in the method signature.
Will Continue…..!