I am learning basic programming in Java and when I try to go through a array
one-dimensional I get this error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 at Array_2.main(Array_2.java:6)
And I really do not know what I can do to solve it, this is the code:
public class Array_2 {
public static void main(String args[]) {
int t = 0;
int numeros[] = new int[5];
for (int i = 0; i <= 5; i++) {
numeros[i] = i + 10;
}
for (int j = 0; j <= 5; j++) {
System.out.println(numeros[t]);
t++;
}
}
}