A Brief Note on Exception Handling
A brief introduction to exception handling is given with the help of an example in this lesson.
We'll cover the following
As an error occurs, an exception object is created. This exception object tells us about the error that occurred.
There are many types of exception objects that are created during programming. One of them is the java.lang.Exception
. The Java compiler checks for these exceptions. Exceptions can be thrown during the normal operation of the JVM. As programmers, it is our responsibility to catch them.
Coding example: 90
In this example, we will learn how to handle one of the most common Java exceptions, the ArithmeticException
where you cannot divide a number by zero.
Get hands-on with 1200+ tech skills courses.