Throwable

Name

Throwable

Synopsis

Description

The Throwable class is the superclass of all objects that can be thrown by the throw statement in Java. This is a requirement of the throw statement.

A Throwable object can have an associated message that provides more detail about the particular error or exception that is being thrown.

The Throwable class provides a method that outputs information about the state of the system when an exception object is created. This method can be useful in debugging Java programs.

The subclasses of Throwable that are provided with Java do not add functionality to Throwable. Instead, they offer more specific classifications of errors and exceptions.

Class Summary

public class java.lang.Throwable extends java.lang.Object implements java.lang.Serializable {
 // Constructors public Throwable();
public Throwable(String message); // Instance Methods public native Throwable fillInStackTrace();
public String getLocalizedMessage(); // New in 1.1 public String getMessage();
public void printStackTrace();
public void printStackTrace(PrintStream s);
public void printStackTrace(PrintWriter s); // New in 1.1 public String toString();
}

Constructors

Throwable

public Throwable()

public Throwable(String message)

Instance Methods

fillInStackTrace

public native Throwable fillInStackTrace()

getLocalizedMessage

public String getLocalizedMessage()

getMessage

public String getMessage()

printStackTrace

public void printStackTrace()

public void printStackTrace(PrintStream s)

public void printStackTrace(PrintStream w)

toString

public String toString()

Inherited Methods

Method Inherited From Method Inherited From
clone() Object equals(Object) Object
finalize() Object getClass() Object
hashCode() Object notify() Object
notifyAll() Object wait() Object
wait(long) Object wait(long, int) Object

See Also

Errors; Exceptions; Object