public class dereks {
public static void main (String [] args){
int array [] = {1,2,3,5,6,7};
int sum =0;
for(int counter=0; counter<=array.length; counter++){
sum+=array[counter];
}
System.out.println(sum);
}
}
谁能告诉我这是怎么回事??我不明白为什么我收到错误消息 "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 at dereks.main(dereks.java:7)" 。