08-数组和数组的增强for循环
作者:互联网
public class demo004 {
public static void main(String[] args) {
int[] arrs = {1,2,3,4,5};
System.out.println(arrs);
int sum = 0;
for (int i = 0; i < arrs.length; i++) {
sum += arrs[i];
}
System.out.println(sum);
// 增强for循环 for (int temp :arrs){ System.out.println(temp); }
} }
// 增强for循环 for (int temp :arrs){ System.out.println(temp); }
} }
标签:temp,int,08,System,循环,arrs,数组,println,public 来源: https://www.cnblogs.com/yuchengxiong/p/15039671.html