Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

155
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda