Sunday 29 June 2014

Exception Handling

Exception Handling 

-Run time error results in Exception.It leads to abnormal termination of program giving some garbage value.
-Whenever exception occurs Java creates an object of "Exception" or its derive class .
-Handling this error makes user aware is called Exception Handling.
-For Exception Handling java provides :~
Constructs :
  ~It contain a body.
  ~ try,catch,finally.
Statements :
 ~It is one single executable line.
 ~ throw,throws.
#  Constructs 
       try :
+ It is a keyword so written in small letters.
+ All statement that may result in an error are written within try.
+ A method can have nested or multiple try blocks.
+ After each try there is one catch and more but run only one having exception.

     catch :
+ catch is conditional only when exception occurs.
      finally :
+ finally can be used as substitute / along with catch.
+ There can be only one finally.
finally is unconditional.
# Statements :
 throw :
+ It is used to generate an exception.

throws :
+ It is used to forward an exception.







1 comment:

  1. very informative post for me as I am always looking for new content that can help me and my knowledge grow better.

    ReplyDelete

Chapter : 1 - First code in Node JS Previously I have written a blog about Getting Started with Node JS and its installation. Now lets s...