public class RuntimeException
extends 异常
| java.lang.Object | |||
| ↳ | java.lang.Throwable | ||
| ↳ | java.lang.Exception | ||
| ↳ | java.lang.RuntimeException | ||
RuntimeException是在Java虚拟机正常运行期间可以引发的那些异常的超类。
RuntimeException及其子类是未经检查的例外 。 unchecked异常不需要在方法或构造函数的拟申报throws条款,如果他们可以通过该方法或构造函数的执行被抛出和方法或构造边界之外传播。
Public constructors |
|
|---|---|
RuntimeException() 用 |
|
RuntimeException(String message) 用指定的详细信息构造一个新的运行时异常。 |
|
RuntimeException(String message, Throwable cause) 用指定的详细信息和原因构造一个新的运行时异常。 |
|
RuntimeException(Throwable cause) 构造具有指定的原因和 (cause==null ? null : cause.toString())详细消息(它通常包含的 cause类和详细信息)的新的运行时异常。 |
|
Protected constructors |
|
|---|---|
RuntimeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) 使用指定的详细消息,原因,抑制启用或禁用以及可写堆栈跟踪启用或禁用构造新的运行时异常。 |
|
Inherited methods |
|
|---|---|
java.lang.Throwable
|
|
java.lang.Object
|
|
RuntimeException ()
用null作为详细消息构造一个新的运行时异常。 原因未初始化,并可能随后通过致电initCause(Throwable)进行初始化。
RuntimeException (String message)
用指定的详细信息构造一个新的运行时异常。 原因未初始化,并可能随后通过致电initCause(Throwable)进行初始化。
| Parameters | |
|---|---|
message |
String: the detail message. The detail message is saved for later retrieval by the getMessage() method. |
RuntimeException (String message, Throwable cause)
用指定的详细信息和原因构造一个新的运行时异常。
请注意,与 cause相关的详细消息 不会自动合并到此运行时异常的详细消息中。
| Parameters | |
|---|---|
message |
String: the detail message (which is saved for later retrieval by the getMessage() method). |
cause |
Throwable: the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.) |
RuntimeException (Throwable cause)
构造具有指定的原因和(cause==null ? null : cause.toString())详细消息(它通常包含的cause类和详细信息)的新的运行时异常。 这个构造函数对于运行时异常很有用,它比其他throwables的包装稍微多一些。
| Parameters | |
|---|---|
cause |
Throwable: the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.) |
RuntimeException (String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace)
使用指定的详细消息,原因,抑制启用或禁用以及可写堆栈跟踪启用或禁用构造新的运行时异常。
| Parameters | |
|---|---|
message |
String: the detail message. |
cause |
Throwable: the cause. (A null value is permitted, and indicates that the cause is nonexistent or unknown.) |
enableSuppression |
boolean: whether or not suppression is enabled or disabled |
writableStackTrace |
boolean: whether or not the stack trace should be writable |