In this tutorial we will discuss what is an exception and how it can be handled in java programming language.
What is an exception?
An Exception can be anything which interrupts the normal flow of the program. When an exception occurs program processing gets terminated and doesn’t continue further. In such cases we get a system generated error message. The good thing about exceptions is that they can be handled. We will cover the handling part later in this same tutorial.
When an exception can occur?
Exception can occur at runtime (known as runtime exceptions) as well as at compile-time (known Compile-time exceptions).
Reasons for Exceptions:
There can be several reasons for an exception. For example, following situations can cause an exception – Opening a non-existing file,...