Sunday, July 4, 2010

Exception Handling Basics

A Java exception is an object that describes an exceptional (that is, error) condition that has occurred in a piece of code. When an exceptional condition arises, an object representing that exception is created and thrown in the method that caused the error. That method may choose to handle the exception itself, or pass it on. The exception is caught and processed.


Exceptions can be generated by:

1. Java run-time system (Exceptions thrown by Java relate to fundamental errors that violate the rules of the Java language or the constraints of the Java execution environment.

2. User code. (Manually generated exceptions are typically used to report some error condition to the caller of a method.)

No comments:

Post a Comment