20.22
java.lang.Throwable
and its Subclasses
THE PACKAGE JAVA.LANG
By convention, class
Throwable
and all its subclasses have two constructors,
one that takes no arguments and one that takes a
String
argument that can be
used to produce an error message. This is true of all the classes shown above, with
one exception:
ExceptionInInitializerError
. These predefined classes oth
erwise have no new content; they merely inherit methods from class
Throwable
.
public class Throwable {
public Throwable();
public Throwable(String message);
public String toString();
public String getMessage();
public Throwable fillInStackTrace();
public void printStackTrace();
public void printStackTrace(java.io.PrintStream s);
}
20.22.1
public Throwable()
This constructor initializes a newly created
Throwable
object with
null
as its
error message string. Also, the method
fillInStackTrace
( 20.22.5) is called
for this object.
20.22.2
public Throwable(String message)
This constructor initializes a newly created
Throwable
object by saving a refer
ence to the error message string
s
for later retrieval by the
getMessage
method
( 20.22.3). Also, the method
fillInStackTrace
( 20.22.5) is called for this
object.
20.22.3
public String getMessage()
If this
Throwable
object was created with an error message string ( 20.22.2),
then a reference to that string is returned.
If this
Throwable
object was created with no error message string ( 20.22.1),
then
null
is returned.
20.22.4
public String toString()
If this
Throwable
object was created with an error message string ( 20.22.2),
then the result is the concatenation of three strings:
612
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved