This PPT has the basic instroduction of the Throwable class. it contains it's contructor and methods with explanations and example. i hope it may help you.
2. Content
1. What is Throwable class
2. Class Constructors
3. Class Methods
4. Use
3. What is Throwable class ?
The Throwable class is the superclass of all errors
and exceptions in the Java language.
Only objects that are instances of this class (or of
one of its subclasses) are thrown by the Java
Virtual Machine or can be thrown by the
Java throw statement.
Similarly, only this class or one of its subclasses
can be the argument type in a catch clause.
4. • This diagram
illustrates the
class hierarchy
of the
Throwable
class and its
most
significant subclasses.
• Most programs throw and catch objects that
derive from the Exception class. Exceptions
indicate that a problem occurred but that the
problem is not a serious systemic problem
6. 2. Throwable(String message) : This constructs
a new throwable with the specified detail
message.
Example :
O/P :
7. 3. Throwable(String message, Throwable
cause) : This constructs a new throwable with the
specified detail message and cause.
Example :
O/P :
8. Class Methods
1. getMessage() : Returns the detail message string of
this throwable (which may be null).
2. getCause() : Returns the cause of this throwable or
null.
3. initCause(Throwable cause) : Initializes
the cause of this throwable to the specified value.
EX :
9. 4. getLocalizedMessage() : Creates a localized
description of this throwable. Subclasses may
override this method in order to produce a locale-
specific message.
EX :
O/P :