Java Exception.

Java Exception

  • An exception is an event, which occurs during the execution of a program, which disrupts the normal flow of the program's instructions.
  • Exceptions are represented by instances of the class java.lang.Exception and its subclasses.
  • An exception indicates an unusual condition or an error condition.
  • Program control becomes unconditionally transferred or "thrown" to a specially designated section of code where it's caught and handled.
  • The list of methods called is known as the call stack.
  • After a method throws an exception, the runtime system attempts to find something to handle it.

What Is Unchecked exception?

  • Since these exceptions are generally none-recoverable - they cannot usually be handled by the program.
  • Two kinds:
    1. error : exceptional conditions that are external to the application.
    2. runtime exception : exceptional conditions that are internal to the application.
  • These exceptions do not have to be included in a method’s throws list or caught.
  • The compiler does not check to see if the methods handles this type of error.

What Is Checked exception?

  • These are exceptional conditions that a well-written application should anticipate and recover from.
  • Checked exceptions are subject to the Catch or Specify Requirement.
© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.