We are going to discus about Exception handling in java. Java program many provides exception. We are handle of error in program when during execution in a program .we are generate of exception try() block and catch() block. We are handle of exception checked and unchecked exception. There are many reason of including in exception handling.Thses exception are manly cause by user because user are mistake invalid data entered and invalid operator.
There are two types of exception:-
Checked Exception are handle of Exception at compile-time. This exception are object of the exception class. The Checked Exception The Checked Exception are many type.
|Checked Exception||Reason for Exception|
|ClassNotFoundException||ClassNotFoundException is displayed when java run-time System fails to find the specified class in the program|
|Instantiation Exception||Instantiation Exception is displayed when we have created an object of an abstract class and interface.|
IIIegalAccessException is displayed when we have created an object of an abstract class and Interface.
|NoSuchMethodException||NOtSuchMethodException is displayed when we have called method but
does not exit in class
Unchecked Exception are handle of Exception Runtime. Unchecked Exception are not handle at compile-time but we are handle the runtime. There are many types of handle unchecked Exception handle of compile-time. This Exception displayed due to invalid argument passed to method
|Unchecked Exception||Reason for Exception|
This Exception is displayed, when we are try to convert a string variable in wrong format to integer that is not compatible with each other
Arithmetic Exception is displayed, when we are divide a number by zero reasons an Arithmetic Exception.
NullPointerException exception is displayed when we implement an application without referring to the object and allocating to a memory.
|Class Cast Exception||
Class Cast Exception is displayed when we try to assign a reference variable of a class to an incompatible reference variable of another class
|Array Index Out Of Bounds Exception||
Array Index Out Of Bounds Exception is displayed when we assign an array which is not compatible with the data type of that array.
Posted on: May 24, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles