Exception Handling in Java (Explained!)

Exception Handling in Java (Explained!)

Hello! guys, today we are going to learn Exception Handling in Java. So first of all let me tell you that “Exception” and “Errors” both are very much different from one another. The major difference between Exception and Error is, “Exception” is a thing or just a nuisance that is obviously done by humans (by us) by which the system just hangs into it without detecting it. On the other side “Error” is a mistake (can be logical or anything else) which the system already knows and gives us a message to correct it.

Lets start with the types of exception in Java :
Generally, there are 2 types of Exceptions in Java – Unchecked Exceptions and Checked Exceptions. Further these Exceptions are divided into more categories which are explained in the below table.


Exception Description
ArithmeticException Arithmetic errors, such as divide by zero or anything else
ArrayIndexOutOfBoundsException Array Index gets out of memory
ArrayStoreException Storage of the Array elements which are of incompatible type
ClassCastException Invalid Class Cast!
IllegalArgumentException Illegal arguments to invoke a method
IllegalMonitorStateException Illegal monitor operations, like waiting on a unlocked thread
IllegalStateException Program in an incorrect state
IllegalThreadStateException Operation not compatible with the current thread state
IndexOutOfBoundsException Index out of memory
NegativeArraySizeException Array of negative size
NullPointerException Illegal use of null pointer
NumberFormatException Conversion error of number format
SecurityException Security Violation leads to this exception
StringIndexOutOfBounds String index out of memory
UnsupportedOperationException Operation which is unsupported


Exception Description
ClassNotFoundException Class is not found
CloneNotSupportedException Illegal attempt to clone an object, which is cannot be implemented on clonable interface
IllegalAccessException Illegal access to a Class
InstantiationException To create an object of an abstract class or interface
InterruptedException Process interrupted due to threads
NoSuchFieldException File does not exist
NoSuchMethodException Method does not exist

These are the types of exceptions, in our next post we’ll try to implement some examples on Exception Handling. So stay tuned and keep sharing your knowledge…
Don’t forget to share our blog with your friends and mates…

Author Description


Our mission is to bring the affordable Technology education to people everywhere, in order to help them achieve their dreams and change the world. - Follow @program_guide

There are 1 comments. Add yours

  1. Pingback: Exception Handling (Arithmetic Exception) - Divide by Zero | Coders Don't Sleep November 9, 2013

    […] after a brief explanation on Exception Handling, today we are goona implement “Exception Handling” (Arithmetic Exception) by taking a […]

Join the Conversation