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): 26952/ 36

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

User Comments

Title: exception handling   
Name: sireesha
Date: 2011-03-09 11:17:54 AM
Comment:
very nice notes.
Title: very effective   
Name: bindu
Date: 2010-12-27 2:37:02 AM
Comment:
the article is very clear and effective
Title: good   
Name: anil
Date: 2008-05-14 4:51:03 AM
Comment:
it's every one easy understand
Title: compact   
Name: Sharon
Date: 2007-10-03 1:39:57 AM
Comment:
The discernment of the topic was quite applicable
Title: Great   
Name: Abhas
Date: 2007-08-27 11:47:42 AM
Comment:
Your style of writing articles is just great
Title: Good work   
Name: John
Date: 2007-08-21 11:27:32 AM
Comment:
Keep up the good work

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-24 9:07:05 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search