IllegalStateException

java.lang.Object
|---java.lang.Throwable
|---|---java.lang.Exception
|---|---|---java.lang.RuntimeException
|---|---|---|---java.lang.IllegalStateException
public class IllegalStateException
extends RuntimeException表示方法已在非法或不适当的时间被调用。 换言之,Java 环境或 Java 应用程序未处于请求操作的适当状态。
构造函数摘要
| 构造函数 | 描述 |
|---|---|
| IllegalStateException() | 构造一个不带详细消息的 IllegalStateException。 |
| IllegalStateException(String s) | 构造带有指定详细消息的 IllegalStateException。 |
| IllegalStateException(String message, Throwable cause) | 使用指定的详细消息和原因构造一个新异常。 |
| IllegalStateException(Throwable cause) | 构造一个具有指定原因的新异常和 (cause==null ? null : cause.toString()) 的详细消息(通常包含原因的类和详细消息)。 |
方法总结
| 从类 java.lang.Object 继承的方法 |
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 从类 java.lang.Throwable 继承的方法 |
|---|
| addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
构造函数详细信息
IllegalStateException
public IllegalStateException()
构造一个不带详细消息的 IllegalStateException。 详细消息是描述此特定异常的字符串。
IllegalStateException
public IllegalStateException(String s)
构造带有指定详细消息的 IllegalStateException。 详细消息是描述此特定异常的字符串。
参数:
| 参数名称 | 参数描述 |
|---|---|
| s | 包含详细消息的字符串 |
IllegalStateException
public IllegalStateException(String message, Throwable cause)
使用指定的详细消息和原因构造一个新异常。
请注意,与原因相关的详细消息不会自动合并到此异常的详细消息中。
参数:
| 参数名称 | 参数描述 |
|---|---|
| message | 详细消息(保存以供 Throwable#getMessage() 方法稍后检索)。 |
| cause | 原因(由 Throwable#getCause() 方法保存以供以后检索)。 (允许使用空值,表示原因不存在或未知。) |
IllegalStateException
public IllegalStateException(Throwable cause)
构造一个具有指定原因的新异常和 (cause==null ? null : cause.toString()) 的详细消息(通常包含原因的类和详细消息)。 此构造函数对于仅是其他 throwable 的包装器(例如 PrivilegedActionException)的异常非常有用。
参数:
| 参数名称 | 参数描述 |
|---|---|
| cause | 原因(由 Throwable#getCause() 方法保存以供以后检索)。 (允许使用空值,表示原因不存在或未知。) |
本文题目:创新互联鸿蒙OS教程:鸿蒙OSIllegalStateException
文章转载:http://www.jxjierui.cn/article/cdiipcg.html


咨询
建站咨询
