[Chapter 12] Error
Author: Mark Grand and Jonathan Knudsen
Date: Fri Aug 8 17:00:49 1997

#

| Chapter 12 The java.lang Package |

# Error

## Name

Error

## Synopsis

Class Name:

  `java.lang.Error`

Superclass:

  `java.lang.Throwable`

Immediate Subclasses:

  `java.awt.AWTError`, `java.lang.LinkageError`,

  `java.lang.ThreadDeath`,

  `java.lang.VirtualMachineError`

Interfaces Implemented:

  None

Availability:

  JDK 1.0 or later

## Description

The `Error` class is the superclass of all of the standard error classes that can be thrown in Java. The subclasses of `Error` are normally thrown by the class loader, the virtual machine, or other support code. Application-specific code should not normally throw any of the standard error classes.

An `Error` or one of its subclasses is typically thrown when an unpredictable run-time error, such as running out of memory, occurs. Because of the unpredictable nature of the events that cause errors to be thrown, a method does not have to declare the `Error` class or any of its subclasses in the `throws` clause of its method declaration.

A Java program should not try to handle the standard error classes. Most of these error classes represent nonrecoverable errors and as such, they cause the Java run-time system to print an error message and terminate program execution.

## Class Summary

    public class java.lang.Error extends java.lang.Throwable {
      // Constructors
      public Error();
      public Error(String s);
    }

## Constructors

### Error

#### public Error()

Description

  This constructor creates an `Error` with no associated detail message.

#### public Error(String s)

Parameters

  `s`

    The detail message.

Description

  This constructor creates an `Error` with the specified detail message.

## Inherited Methods

Method | Inherited From | Method | Inherited From
--- | --- | --- | ---
`clone()` | `Object` | `equals(Object)` | `Object`
`fillInStackTrace()` | `Throwable` | `finalize()` | `Object`
`getClass()` | `Object` | `getLocalizedMessage()` | `Throwable`
`getMessage()` | `Throwable` | `hashCode()` | `Object`
`notify()` | `Object` | `notifyAll()` | `Object`
`printStackTrace()` | `Throwable` | `printStackTrace(PrintStream)` | `Throwable`
`printStackTrace(PrintWriter)` | `Throwable` | `toString()` | `Object`
`wait()` | `Object` | `wait(long)` | `Object`
`wait(long, int)` | `Object` |  |

## See Also

`LinkageError`, `ThreadDeath`, `Throwable`, `VirtualMachineError`

Double |  | Exception