Exception Handling in Java
page 1 of 5
Published: 21 Aug 2007
Abstract
This article describes the exceptions that can occur during the execution of a Java program and how to handle them along with examples.
by Debjani Mallick
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 6505/ 132

Introduction

Exception is an event occurrence which disrupts the normal flow of execution of instructions in a program. Java uses this to handle errors and other exceptional events.

When an error occurs in a method, an object (exception object) is created by the method which is handed over to the runtime system. This process is called throwing an exception. The object contains the details of the error, its type, etc. The runtime system after receiving the exception tries to find an appropriate way to handle it. The runtime method searches the call stack to find an appropriate method containing the code for handling the exception. That block of code is called exception handler.

When the type of exception thrown by the runtime system matches with the type of exception that can be handled by an exception handler in a method, then the exception is passed on to the handler so that it can catch the exception. If the runtime system does find any appropriate handler for the exception, the runtime system and consequently the program terminates. Normally we have three types of exceptions: checked exceptions, errors and runtime exceptions.


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 7 and 8 and type the answer here:

User Comments

Title: good   
Name: anil
Date: 5/14/2008 4:51:03 AM
Comment:
it's every one easy understand
Title: compact   
Name: Sharon
Date: 10/3/2007 1:40:43 AM
Comment:
The discernment of the topic was quite applicable
Title: compact   
Name: Sharon
Date: 10/3/2007 1:39:57 AM
Comment:
The discernment of the topic was quite applicable
Title: Great   
Name: Abhas
Date: 8/27/2007 11:47:42 AM
Comment:
Your style of writing articles is just great
Title: Nice one   
Name: Kin
Date: 8/24/2007 12:54:47 PM
Comment:
Go on
Title: Good work   
Name: John
Date: 8/21/2007 11:27:32 AM
Comment:
Keep up the good work

Product Spotlight
Product Spotlight 
Learn More
.NET Tools
asp.net shopping cart
asp.net chart control






Ads Powered by Lake Quincy Media
Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2008 ASPAlliance.com  |  Page Processed at 8/30/2008 7:32:15 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search