Showing posts with label java exceptions. Show all posts
Showing posts with label java exceptions. Show all posts

11/16/11

Java Tutorial : Exceptions in Java

An exception is a problem that arises during the execution of a program. An exception can occur for many different reasons, including the following:
  1. A user has entered invalid data.
  2. A file that needs to be opened cannot be found.
  3. A network connection has been lost in the middle of communications, or the JVM has run out of memory.


5/18/11

Java: Declaring Your own Exceptions tutorial

You can create your own exceptions in Java. Keep the following points in mind when writing your own exception classes:
  1. All exceptions must be a child of Throwable.
  2. If you want to write a checked exception that is automatically enforced by the Handle or Declare Rule, you need to extend the Exception class.
  3. If you want to write a runtime exception, you need to extend the RuntimeException class.