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