I'm trying to save numbers to an array through Scanner Input but
"java.lang.ArrayIndexOutOfBoundsException" keeps popping up.
Here is my code:
for (int counter = 1;1==1;counter++) {
int bucky[] = new int[counter];
int scan = oof.nextInt();
bucky[counter] = scan;
if (counter == 5) {
System.out.println(bucky);
}
Can someone explain what I'm doing wrong or where I'm going wrong in my thought process?