< prev index next >

src/java.base/share/classes/java/lang/RuntimeException.java

Print this page




  24  */
  25 
  26 package java.lang;
  27 
  28 /**
  29  * {@code RuntimeException} is the superclass of those
  30  * exceptions that can be thrown during the normal operation of the
  31  * Java Virtual Machine.
  32  *
  33  * <p>{@code RuntimeException} and its subclasses are <em>unchecked
  34  * exceptions</em>.  Unchecked exceptions do <em>not</em> need to be
  35  * declared in a method or constructor's {@code throws} clause if they
  36  * can be thrown by the execution of the method or constructor and
  37  * propagate outside the method or constructor boundary.
  38  *
  39  * @author  Frank Yellin
  40  * @jls 11.2 Compile-Time Checking of Exceptions
  41  * @since   1.0
  42  */
  43 public class RuntimeException extends Exception {

  44     static final long serialVersionUID = -7034897190745766939L;
  45 
  46     /** Constructs a new runtime exception with {@code null} as its
  47      * detail message.  The cause is not initialized, and may subsequently be
  48      * initialized by a call to {@link #initCause}.
  49      */
  50     public RuntimeException() {
  51         super();
  52     }
  53 
  54     /** Constructs a new runtime exception with the specified detail message.
  55      * The cause is not initialized, and may subsequently be initialized by a
  56      * call to {@link #initCause}.
  57      *
  58      * @param   message   the detail message. The detail message is saved for
  59      *          later retrieval by the {@link #getMessage()} method.
  60      */
  61     public RuntimeException(String message) {
  62         super(message);
  63     }




  24  */
  25 
  26 package java.lang;
  27 
  28 /**
  29  * {@code RuntimeException} is the superclass of those
  30  * exceptions that can be thrown during the normal operation of the
  31  * Java Virtual Machine.
  32  *
  33  * <p>{@code RuntimeException} and its subclasses are <em>unchecked
  34  * exceptions</em>.  Unchecked exceptions do <em>not</em> need to be
  35  * declared in a method or constructor's {@code throws} clause if they
  36  * can be thrown by the execution of the method or constructor and
  37  * propagate outside the method or constructor boundary.
  38  *
  39  * @author  Frank Yellin
  40  * @jls 11.2 Compile-Time Checking of Exceptions
  41  * @since   1.0
  42  */
  43 public class RuntimeException extends Exception {
  44     @java.io.Serial
  45     static final long serialVersionUID = -7034897190745766939L;
  46 
  47     /** Constructs a new runtime exception with {@code null} as its
  48      * detail message.  The cause is not initialized, and may subsequently be
  49      * initialized by a call to {@link #initCause}.
  50      */
  51     public RuntimeException() {
  52         super();
  53     }
  54 
  55     /** Constructs a new runtime exception with the specified detail message.
  56      * The cause is not initialized, and may subsequently be initialized by a
  57      * call to {@link #initCause}.
  58      *
  59      * @param   message   the detail message. The detail message is saved for
  60      *          later retrieval by the {@link #getMessage()} method.
  61      */
  62     public RuntimeException(String message) {
  63         super(message);
  64     }


< prev index next >