【问题标题】:Exception Exception in thread "main" java.util.NoSuchElementException线程“main”中的异常异常 java.util.NoSuchElementException
【发布时间】:2019-06-24 07:57:05
【问题描述】:

我有一个例外NoSuchElementException;

我的程序本身没有完成,但我无法弄清楚这个错误,我知道这是个小问题 它与 int 输入有关。我不确定我是否遗漏了什么

int low= in.nextInt(); 
in.nextLine();
System.out.println(low);
int high= in.nextInt();
in.nextLine();
System.out.println(high);
int secretNum= in.nextInt();
in.nextLine();
System.out.println(secretNum);
int [] arr= new int [high];

【问题讨论】:

  • 我添加了一个 System.out.println();它解决了它!

标签: exception nosuchelementexception


【解决方案1】:

想通了谢谢 System.out.println();在第一次之后 int 低= in.nextInt(); 一切顺利!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-20
    • 2020-01-22
    • 2018-03-19
    • 2013-03-02
    相关资源
    最近更新 更多