模块 java.base
 java.lang

类 IllegalStateException

所有已实现的接口:
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
参见:
  • 构造方法详细信息

    • IllegalStateException

      public IllegalStateException()
      构造一个没有详细消息的 IllegalStateException。详细消息是描述此特定异常的字符串。
    • IllegalStateException

      public IllegalStateException(String  s)
      构造带有指定详细消息的 IllegalStateException。详细消息是描述此特定异常的字符串。
      参数:
      s - 包含详细消息的字符串
    • IllegalStateException

      public IllegalStateException(String  message, Throwable  cause)
      构造具有指定详细消息和原因的新异常。

      请注意,与 cause 关联的详细消息是not自动并入此异常的详细消息中。

      参数:
      message - 详细消息(保存以供以后通过 Throwable.getMessage() 方法检索)。
      cause - 原因(保存以供以后通过 Throwable.getCause() 方法检索)。 (允许使用 null 值,表示原因不存在或未知。)
      自从:
      1.5
    • IllegalStateException

      public IllegalStateException(Throwable  cause)
      构造一个具有指定原因和 (cause==null ? null : cause.toString()) 详细消息(通常包含 cause 的类和详细消息)的新异常。此构造函数对于仅比其他可抛出对象(例如 PrivilegedActionException )的包装器更多的异常很有用。
      参数:
      cause - 原因(保存以供以后通过 Throwable.getCause() 方法检索)。 (允许使用 null 值,表示原因不存在或未知。)
      自从:
      1.5