EnhancedFor
增强for循环用于数组
//增强for循环用于数组
int[] arr ={
1,2,3,4,5};
for(int i : arr){
System.out.println(i);
}
缺点:不能方便的访问下标
增强for循环用于容器
Collection c = new ArrayList();
c.add(new String("aaa"));
c.
//增强for循环用于数组
int[] arr ={
1,2,3,4,5};
for(int i : arr){
System.out.println(i);
}
缺点:不能方便的访问下标
Collection c = new ArrayList();
c.add(new String("aaa"));
c.