Exception Handling in JAVA

Basic Exception Handling Overview


Category: Java Tags: Java


Exception Handling:

Anunwanted, unexpected event that disturbs normal flow of the program is calledException.

Example : FileNotFondException

purpose of Exception Handling?
        The main purpose of Exception Handling isfor graceful termination of the program.


Exception Handling doesn’t mean repairing an Exception, we have to definealternative way to continue rest of the code normally.
Example: If our programming requirement is to read the data from the filelocating at London but at Runtime if London file is not available then we haveto use local file alternatively to continue rest of program normally. This isnothing but Exception Handling.

How it works :

Exception handling has three blocks.
1. try block --- try {------}
2. catch block --------catch(Exception related Class) { ------- }
3 finally block. -------- finally{------------}


for Exception Handling  all risky code should  be inside the try block.
now question arises what will happen after putting risky codes in Try block.

Like 1 Person
Published on 4 July 2013
Arun

Arun
Software Engineer at SixDEE Telecom Solutions
Atricles: 1
Questions: 0
Given Best Solutions: 0 *

Reference:

Khalid Mugal

Comments:

Nikhil Joshi
Thanks bro for post an article here ... :)
Like 0 People on 4 July 2013

You are not loggedin, please login or signup to add comments:

Existing User

Login via:

New User



x