Package java.lang
Class Throwable
- java.lang.Object
-
- java.lang.Throwable
-
- All Implemented Interfaces:
Serializable
,Modified
public class Throwable extends Object implements Serializable, Modified
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 theThrowable
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 nestedThrowable
that represents the original problem that led to thisThrowable
. It is often used for wrapping various types of errors into a commonThrowable
without losing the detailed original error information. When printing the stack trace, the trace of the cause is included.- See Also:
Error
,Exception
,RuntimeException
, Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getMessage()
void
printStackTrace()
void
printStackTrace(PrintStream s)
Prints the throwable and it's stack trace to a print streamString
toString()
Returns a string containing a concise, human-readable description of this object.
-
-
-
Field Detail
-
message
public String message
This field contains a detailed message depending on the exception actually thrown.
-
addr
public int addr
This field contains the machine address where the exception was thrown.
-
-
Method Detail
-
getMessage
public String getMessage()
-
toString
public String toString()
Description copied from class:Object
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.
-
printStackTrace
public void printStackTrace()
-
printStackTrace
public void printStackTrace(PrintStream s)
Prints the throwable and it's stack trace to a print stream- Parameters:
s
- PrintWriter to stream the data to.
-
-