Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
NoSuchElementException doesn't pass a test on Ideone

Please could you tell me what I did wrong. I think my code works correctly but doesn't pass a test on Ideone.

do{
    linia = reading.nextLine();
    try{
        number = Integer.parseInt(linia);
        if(number < 100 && number > -100) {
                sum += number;
                resultList.add(sum);
        }
    }catch(NumberFormatException e){
        //System.out.println("Niepoprawne dane !");
        end = true;
    }
}while(!end);

if(resultList != null) {
    for (int i = 0; i < resultList.size(); i++) {
        System.out.println(resultList.get(i));
    }
} 
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Issue is that in your code, you accept the input on command line from the user using code linia = reading.nextLine(); which is not possible with the IDEONE (online editor) As there it can't supply the user input.

Thats the reason it was working fine locally but failing when you run it on IDEONE.

Removing the code, which ask user input will solve the issue.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!