Exception Handling:-Part1
When an application is developed, it may contain some error
.The error that occurred in a program are classified into two types.
1.
Compile
Time Errors
2.
2.
Runtime Errors
1. Compile Time
Errors:
The Errors that are occurs in a program because of syntactical
mistake are called as compile time error. The Compile Time Error can be identified
by the compiler
2. Runtime Errors:
The Errors that are occurs in a program because of
Programmer failures (Wrong logic) or JVM Failures are called as Runtime Errors.
The Runtime errors cannot be identified by the compiler
Object: Object is
the super most class in all classes in Java
Throwable: The
super most class of all Runtime error classes in Java
The Runtime Error classified into two types.
1. Exception
2. Error
Exception hierarchy diagram
Exception: An
Exception is runtime error, which occurs because of logical failures or invalid
data or wrong input to the application
Exception Class is super most class of all Exceptions Class
Error: An Error
is Runtime Error, which occur because of JVM failures
The Error super most class of all the Errors Class
à The
Exception are classified into the following category based on when they are
identified .
1.
Compile Time Exception
2. Runtime Exception
Compile Time
Exception: The Exception which occurs at runtime and which can be identified
before runtime or during compile time are called as Compile Time Exception
Runtime Exception:
The Exception occur at runtime and which can be identified during runtime are called as Runtime Exception
The Exceptions are further classified into two types based
on whether they are handled or not?
1. Checked Exception
2. Un-Checked Exception
Checked Exception: Exception whose handling is mandatory is called
as Checked Exception
Un-Checked Exception: Exception whose handling is optional
is called Un-Checked Exception
Accordingly Exception hierarchy Runtime Exception and Sub-classes
and Error and Sub-classes are Un-Checked Exception.
0 Comments