Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

157
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda