What
is an exception? Create an exception subclass named MyException to handle user
generate exceptions in Java
Ans
Exception
is a condition Which is Responsible for Occurrence of Error Like Divide by Zero
is an condition that never be possible So we can call it an Exception which
halts or stops the Execution of Program In java there is an Exception Class
Which is Responsible for producing an Error Message when an Error has
occurred.
when
an Exception has occurred then compiler will never reach to the Code that is
placed after the block which contains an error. So that there is special
Mechanism given by java for handling Exceptions When as Exception has occurred
then the Compiler will generate an Exception Code to an Exception Class
and with the help of Exception object. So if we wants to Execute
Statements then we have to handle Exception For handling Exceptions java
provides us special Mechanism which is called as Exception handling Mechanism
Java provide following Methods for handling Exceptions those are occurred in a
program
No comments:
Post a Comment