public class demo3 {
public static void main(String[] args) {
// 增强for循环,也叫forEach遍历 <=> 数组或者集合对象的语法糖
int[] arr = {1,2,3,4,5,6};
// 最笨的方法
for(int i = 0; i < arr.length; i++){
System.out.println("这是" + i);
}
// 语法糖 不能获取数组下标
for(int x:arr){
System.out.println("这是" + x);
}
}
}