public class HelloWorld{ public static void main(String[] args){ int[] nums=new int[]{1,10,5,10,30,9}; int max=0; int min=0; double sum=0; double avg=0; for(int i=0;i<=nums.length;i++){ if (nums[i]>max){ max=nums[i]; } else min=nums[i]; sum=sum+nums[i]; } avg=sum/nums.length; System.out.println("数组中的最大值为:"+max); System.out.println("数组中的最小值为:"+min); System.out.println("数组的平均值为:"+avg); } } 运行后显示 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6 at HelloWorld.main(HelloWorld.java:44) 什么情况啊?
数组越界i<nums.length