Throwable - JRE Emulation | JRE Emulation
public class

Throwable

extends Object
implements Serializable
java.lang.Object
   ↳ java.lang.Throwable
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

The superclass of all classes which can be thrown by the VM. The two direct subclasses are recoverable exceptions (Exception) and unrecoverable errors (Error). This class provides common methods for accessing a string message which provides extra information about the circumstances in which the Throwable was created (basically an error message in most cases), and for saving a stack trace (that is, a record of the call stack at a particular point in time) which can be printed later.

A Throwable can also include a cause, which is a nested Throwable that represents the original problem that led to this Throwable. It is often used for wrapping various types of errors into a common Throwable without losing the detailed original error information. When printing the stack trace, the trace of the cause is included.

Summary

Public Constructors
Throwable()
Throwable(String message)
Throwable(String message, Throwable cause)
Throwable(Throwable cause)
Protected Constructors
Throwable(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace)
Public Methods
final void addSuppressed(Throwable exception)
Throwable fillInStackTrace()
Throwable getCause()
String getLocalizedMessage()
String getMessage()
StackTraceElement[] getStackTrace()
final Throwable[] getSuppressed()
Throwable initCause(Throwable cause)
void printStackTrace()
void printStackTrace(PrintWriter w)
void printStackTrace(PrintStream ps)
void setStackTrace(StackTraceElement[] stackTrace)
String toString()
Returns a string containing a concise, human-readable description of this object.
Inherited Methods
[Expand]
From class java.lang.Object

Public Constructors

public Throwable ()

public Throwable (String message)

public Throwable (String message, Throwable cause)

public Throwable (Throwable cause)

Protected Constructors

protected Throwable (String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace)

Public Methods

public final void addSuppressed (Throwable exception)

public Throwable fillInStackTrace ()

public Throwable getCause ()

public String getLocalizedMessage ()

public String getMessage ()

public StackTraceElement[] getStackTrace ()

public final Throwable[] getSuppressed ()

public Throwable initCause (Throwable cause)

public void printStackTrace ()

public void printStackTrace (PrintWriter w)

public void printStackTrace (PrintStream ps)

public void setStackTrace (StackTraceElement[] stackTrace)

public String toString ()

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.