Introduction
- An exception represents an error condition that can occur during the normal course of program execution.
- When an exception occurs, it is said to be thrown. When it is thrown, the normal flow of the program terminates and the exception handling block will be executed.
- The execution handling block is the catch block. This block will be contain instruction on what to do when an exception is caught. Caught means that when an exception is thrown, the exception handling block will catch the exception thrown.

Methods to use with Exceptions
The following methods will be used to get more information about the thrown exception.
printStackTrace()
getMessage()
throws clause
The throws keyword is used to throw an exception similar to a try & catch block.
How to throw multiple exceptions?
You can use a comma between each exception when declaring them.
Difference between throw & throws
- You can throw only one exception at a time while you can handle multiple exemptions using a throws clause.
- throw is present in the method body where it will throw an error while the throws is used in the method signature and declares any exceptions that may occur during the execution of the statement in the method body.
finally block
- The finally block is part of the try catch block where the statements or instruction in the finally block will execute regardless of whether an exception is handled/thrown or not
- Java finally block is a block that is used to execute important code such as closing connection, stream etc.
- The finally block follows the try &b catch block.
Layman’s Terms
An exception is like an error that occurs while playing a video game. When that error occurs, the game usually crashes and shuts down. What is happening there? When it crashes, an exception is thrown which can be missing files, bugs or anything. The catch block would either give the player instruction of what to do to fix the error, like missing file or something, or restart the game to fix the error.
References
https://www.javatpoint.com/exception-handling-in-java
