模块 java.base
 java.util

类 NoSuchElementException

所有已实现的接口:
Serializable
已知子类:
InputMismatchException

public class NoSuchElementException extends RuntimeException
由各种访问器方法抛出以指示所请求的元素不存在。
自从:
1.0
参见:
  • 构造方法详细信息

    • NoSuchElementException

      public NoSuchElementException()
      构造一个 NoSuchElementException 并将 null 作为其错误消息字符串。
    • NoSuchElementException

      public NoSuchElementException(String  s, Throwable  cause)
      使用指定的详细消息和原因构造一个 NoSuchElementException
      参数:
      s - 详细信息,或 null
      cause - 原因(保存以供以后通过 Throwable.getCause() 方法检索),或 null
      自从:
      15
    • NoSuchElementException

      public NoSuchElementException(Throwable  cause)
      构造具有指定原因的 NoSuchElementException。详细消息设置为 (cause == null ? null : cause.toString())(通常包含 cause 的类和详细消息)。
      参数:
      cause - 原因(保存以供以后通过 Throwable.getCause() 方法检索)
      自从:
      15
    • NoSuchElementException

      public NoSuchElementException(String  s)
      构造一个 NoSuchElementException ,保存对错误消息字符串 s 的引用,以便以后通过 getMessage 方法检索。
      参数:
      s - 详细消息。