Source Home >> Java Source 1.5.0 >> java.lang.Exception V 0.09
  • 01/*
  • 02 * @(#)Exception.java 1.31 03/12/19
  • 03 *
  • 04 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  • 05 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  • 06 */
  • 07
  • 08package java.lang;
  • 09
  • 10/**
  • 11 * The class <code>Exception</code> and its subclasses are a form of
  • 12 * <code>Throwable</code> that indicates conditions that a reasonable
  • 13 * application might want to catch.
  • 14 *
  • 15 * @author Frank Yellin
  • 16 * @version 1.31, 12/19/03
  • 17 * @see java.lang.Error
  • 18 * @since JDK1.0
  • 19 */
  • 20public class Exception extends Throwable {
  • 21 static final long serialVersionUID = -3387516993124229948L;
  • 22
  • 23 /**
  • 24 * Constructs a new exception with <code>null</code> as its detail message.
  • 25 * The cause is not initialized, and may subsequently be initialized by a
  • 26 * call to {@link #initCause}.
  • 27 */
  • 28 public Exception() {
  • 29 super();
  • 30 }
  • 31
  • 32 /**
  • 33 * Constructs a new exception with the specified detail message. The
  • 34 * cause is not initialized, and may subsequently be initialized by
  • 35 * a call to {@link #initCause}.
  • 36 *
  • 37 * @param message the detail message. The detail message is saved for
  • 38 * later retrieval by the {@link #getMessage()} method.
  • 39 */
  • 40 public Exception(String message) {
  • 41 super(message);
  • 42 }
  • 43
  • 44 /**
  • 45 * Constructs a new exception with the specified detail message and
  • 46 * cause. <p>Note that the detail message associated with
  • 47 * <code>cause</code> is <i>not</i> automatically incorporated in
  • 48 * this exception's detail message.
  • 49 *
  • 50 * @param message the detail message (which is saved for later retrieval
  • 51 * by the {@link #getMessage()} method).
  • 52 * @param cause the cause (which is saved for later retrieval by the
  • 53 * {@link #getCause()} method). (A <tt>null</tt> value is
  • 54 * permitted, and indicates that the cause is nonexistent or
  • 55 * unknown.)
  • 56 * @since 1.4
  • 57 */
  • 58 public Exception(String message, Throwable cause) {
  • 59 super(message, cause);
  • 60 }
  • 61
  • 62 /**
  • 63 * Constructs a new exception with the specified cause and a detail
  • 64 * message of <tt>(cause==null ? null : cause.toString())</tt> (which
  • 65 * typically contains the class and detail message of <tt>cause</tt>).
  • 66 * This constructor is useful for exceptions that are little more than
  • 67 * wrappers for other throwables (for example, {@link
  • 68 * java.security.PrivilegedActionException}).
  • 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 Exception(Throwable cause) {
  • 77 super(cause);
  • 78 }
  • 79}

文件:Exception.java
包名:java.lang
类名:Exception
继承:Throwable
接口: