java基础题求教

来源:百度知道 编辑:UC知道 时间:2024/06/05 12:22:58
Scanner类里的方法next nextInt可能抛出哪些异常?(除了InputMismatchException以外)

NoSuchElementException - 如果没有更多标记可用
IllegalStateException - 如果此扫描器已关闭

InputMismatchException - 如果下一个标记与 Integer 正则表达式不匹配,或者超出范围
NoSuchElementException - 如果输入信息已耗尽
IllegalStateException - 如果此扫描器已关闭