Hi, i’m just starting in programming and I don’t know why throws NZEC error, I try to manipulate every error in my code. Thanks for your answers.
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
import java.lang.OutOfMemoryError;
public class Main{
public static void main(String[] args) {
try{
ArrayList nIngresados=new ArrayList();
String entrada;
int stop=0;
while(stop!=42){
Scanner entradaTeclado= new Scanner(System.in);
entrada=entradaTeclado.nextLine();
try{
stop=Integer.parseInt(entrada);
if(stop!=42 && stop<100 && stop>-100)
nIngresados.add(stop);
}
catch(NumberFormatException nfe){
}
}
int i;
for(i=0;i<nIngresados.size();i++){
System.out.println(nIngresados.get(i));
}
System.exit(0);
}
catch(OutOfMemoryError ome){
System.exit(0);
}
System.exit(0);
}
}