KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > lang > RuntimeException


1 /*
2  * @(#)RuntimeException.java 1.13 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.lang;
9
10 /**
11  * <code>RuntimeException</code> is the superclass of those
12  * exceptions that can be thrown during the normal operation of the
13  * Java Virtual Machine.
14  * <p>
15  * A method is not required to declare in its <code>throws</code>
16  * clause any subclasses of <code>RuntimeException</code> that might
17  * be thrown during the execution of the method but not caught.
18  *
19  *
20  * @author Frank Yellin
21  * @version 1.13, 12/19/03
22  * @since JDK1.0
23  */

24 public class RuntimeException extends Exception JavaDoc {
25     static final long serialVersionUID = -7034897190745766939L;
26
27     /** Constructs a new runtime exception with <code>null</code> as its
28      * detail message. The cause is not initialized, and may subsequently be
29      * initialized by a call to {@link #initCause}.
30      */

31     public RuntimeException() {
32     super();
33     }
34
35     /** Constructs a new runtime exception with the specified detail message.
36      * The cause is not initialized, and may subsequently be initialized by a
37      * call to {@link #initCause}.
38      *
39      * @param message the detail message. The detail message is saved for
40      * later retrieval by the {@link #getMessage()} method.
41      */

42     public RuntimeException(String JavaDoc message) {
43     super(message);
44     }
45
46     /**
47      * Constructs a new runtime exception with the specified detail message and
48      * cause. <p>Note that the detail message associated with
49      * <code>cause</code> is <i>not</i> automatically incorporated in
50      * this runtime exception's detail message.
51      *
52      * @param message the detail message (which is saved for later retrieval
53      * by the {@link #getMessage()} method).
54      * @param cause the cause (which is saved for later retrieval by the
55      * {@link #getCause()} method). (A <tt>null</tt> value is
56      * permitted, and indicates that the cause is nonexistent or
57      * unknown.)
58      * @since 1.4
59      */

60     public RuntimeException(String JavaDoc message, Throwable JavaDoc cause) {
61         super(message, cause);
62     }
63
64     /** Constructs a new runtime exception with the specified cause and a
65      * detail message of <tt>(cause==null ? null : cause.toString())</tt>
66      * (which typically contains the class and detail message of
67      * <tt>cause</tt>). This constructor is useful for runtime exceptions
68      * that are little more than wrappers for other throwables.
69      *
70      * @param cause the cause (which is saved for later retrieval by the
71      * {@link #getCause()} method). (A <tt>null</tt> value is
72      * permitted, and indicates that the cause is nonexistent or
73      * unknown.)
74      * @since 1.4
75      */

76     public RuntimeException(Throwable JavaDoc cause) {
77         super(cause);
78     }
79 }
80
Popular Tags