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 theThrowablewas 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
Throwablecan also include a cause, which is a nestedThrowablethat represents the original problem that led to thisThrowable. It is often used for wrapping various types of errors into a commonThrowablewithout 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 StringgetMessage()voidprintStackTrace()voidprintStackTrace(PrintStream s)Prints the throwable and it's stack trace to a print streamStringtoString()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:ObjectReturns 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.
-
-