- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- java.lang.IllegalStateException
-
- All Implemented Interfaces:
-
Serializable
- 已知直接子类:
-
AcceptPendingException,AlreadyBoundException,AlreadyConnectedException,CancellationException,CancelledKeyException,ClosedDirectoryStreamException,ClosedFileSystemException,ClosedSelectorException,ClosedWatchServiceException,ConnectionPendingException,FormatterClosedException,IllegalBlockingModeException,IllegalComponentStateException,IllegalReceiveException,IllegalUnbindException,InvalidDnDOperationException,InvalidMarkException,NoConnectionPendingException,NonReadableChannelException,NonWritableChannelException,NotYetBoundException,NotYetConnectedException,OverlappingFileLockException,ReadPendingException,ShutdownChannelGroupException,WritePendingException
public class IllegalStateException extends RuntimeException
表示在非法或不适当的时间调用了一种方法。 换句话说,Java环境或Java应用程序对于请求的操作并不处于适当的状态。- 从以下版本开始:
- 1.1
- 另请参见:
- Serialized Form
-
-
构造方法摘要
构造方法 Constructor 描述 IllegalStateException()构造一个没有详细消息的IllegalStateException。IllegalStateException(String s)构造具有指定详细消息的IllegalStateException。IllegalStateException(String message, Throwable cause)构造一个新的异常与指定的详细信息和原因。IllegalStateException(Throwable cause)构造具有指定原因的新异常和详细消息为(cause==null ? null : cause.toString())(通常包含类和详细消息为cause)。
-
方法摘要
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from class 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)
构造一个新的异常与指定的详细信息和原因。请注意,与
cause相关联的详细信息不会自动并入此异常的详细消息。- 参数
-
message- 详细信息(保存以供Throwable.getMessage()方法稍后检索)。 -
cause- 原因(保存以供Throwable.getCause()方法稍后检索)。 (允许Anull值,并表示原因不存在或未知。) - 从以下版本开始:
- 1.5
-
IllegalStateException
public IllegalStateException(Throwable cause)
构造具有指定原因的新异常和详细信息(cause==null ? null : cause.toString())(通常包含类别和详细信息为cause)。 这个构造函数对于除了其他可抛弃物的封装外(例如PrivilegedActionException)的异常更有用。- 参数
-
cause- 原因(由Throwable.getCause()方法保存供以后检索)。 (Anull值是允许的,并且表示原因不存在或未知。) - 从以下版本开始:
- 1.5
-
-