例:
int[] element = new int[]
for (int e: element) //e为int类型的类
System.out.println(e);//遍历数组,打印出数组中所有值
增强for循环的语句格式为:
for(variable : collection) statement
例:
int[] element = new int[]
for (int e: element) //e为int类型的类
System.out.println(e);//遍历数组,打印出数组中所有值
增强for循环的语句格式为:
for(variable : collection) statement