求问哪里错了。一直提示这样;Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7 at teest.Xun.main(Xun.java:13)
package teest;
public class Xun {
public static void main(String[] args) {
// TODO Auto-generated method stub
int [] nums={61,23,4,74,13,148,20};
int max=nums[0];
int min=nums[0];
int sum=0;
double avg=0;
for(int i=0;i<=nums.length;i++){
if(nums[i]>max){
max=nums[i];
}
if(nums[i]<min){
min=nums[i];
}
sum=sum+nums[i];
}
avg=sum/nums.length;
System.out.println("最大值:"+max);
System.out.println("最小值:"+min);
System.out.println("平均值:"+avg);
}
}