Exception Handling:-
Exception
is an abnormal condition, if it is occured in our program, then program will be
terminated suddenly.
To
overcome this problem, we have some exception handlers in java program, such as
try,catch,throw,throws and finally.
Exceptions
are occured at runtime.
Basically,
a java program may face two kinds of abnormal conditions. such as, Error and
Exception.
Exceptions
are handled by java program whereas Errors can not be trapped.
Error
§ NoSuchMethodError
§ NoClassDefFoundError
Usually,
we have two types of Exception.
i)
Checked Exception
They are checked at compilation time.
eg:
IOException, ClassNotFoundException, SQLException,UnKnownHostException.
ii) Unchecked Exception
They
are checked at runtime.
eg:-
· NumberFormatException
· ArithmeticException
· NullPointerException
· ArrayIndexOutOfBoundsException
· NegativeArraySizeException.etc.,
No comments:
Post a Comment