int[] nums = {3,5,7,5,5}; int i=0; for(int ea:nums){ System.out.println(ea); nums[i] = i+1; System.out.println("数组中的"+i+"值:"+nums[i]); //输出1,2,3,4,5 i++; //System.out.println("数组中的"+i+"值:"+nums[i]); 输出3,5,7,5,5 }
ziom
相关分类