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. package java.lang;
  8. /**
  9. * <code>RuntimeException</code> is the superclass of those
  10. * exceptions that can be thrown during the normal operation of the
  11. * Java Virtual Machine.
  12. * <p>
  13. * A method is not required to declare in its <code>throws</code>
  14. * clause any subclasses of <code>RuntimeException</code> that might
  15. * be thrown during the execution of the method but not caught.
  16. *
  17. *
  18. * @author Frank Yellin
  19. * @version 1.13, 12/19/03
  20. * @since JDK1.0
  21. */
  22. public class RuntimeException extends Exception {
  23. static final long serialVersionUID = -7034897190745766939L;
  24. /** Constructs a new runtime exception with <code>null</code> as its
  25. * detail message. The cause is not initialized, and may subsequently be
  26. * initialized by a call to {@link #initCause}.
  27. */
  28. public RuntimeException() {
  29. super();
  30. }
  31. /** Constructs a new runtime exception with the specified detail message.
  32. * The cause is not initialized, and may subsequently be initialized by a
  33. * call to {@link #initCause}.
  34. *
  35. * @param message the detail message. The detail message is saved for
  36. * later retrieval by the {@link #getMessage()} method.
  37. */
  38. public RuntimeException(String message) {
  39. super(message);
  40. }
  41. /**
  42. * Constructs a new runtime exception with the specified detail message and
  43. * cause. <p>Note that the detail message associated with
  44. * <code>cause</code> is <i>not</i> automatically incorporated in
  45. * this runtime exception's detail message.
  46. *
  47. * @param message the detail message (which is saved for later retrieval
  48. * by the {@link #getMessage()} method).
  49. * @param cause the cause (which is saved for later retrieval by the
  50. * {@link #getCause()} method). (A <tt>null</tt> value is
  51. * permitted, and indicates that the cause is nonexistent or
  52. * unknown.)
  53. * @since 1.4
  54. */
  55. public RuntimeException(String message, Throwable cause) {
  56. super(message, cause);
  57. }
  58. /** Constructs a new runtime exception with the specified cause and a
  59. * detail message of <tt>(cause==null ? null : cause.toString())</tt>
  60. * (which typically contains the class and detail message of
  61. * <tt>cause</tt>). This constructor is useful for runtime exceptions
  62. * that are little more than wrappers for other throwables.
  63. *
  64. * @param cause the cause (which is saved for later retrieval by the
  65. * {@link #getCause()} method). (A <tt>null</tt> value is
  66. * permitted, and indicates that the cause is nonexistent or
  67. * unknown.)
  68. * @since 1.4
  69. */
  70. public RuntimeException(Throwable cause) {
  71. super(cause);
  72. }
  73. }