java基础[04]
时间:2021-04-14 12:36:49
收藏:0
阅读:0
增强for循环
public class ForDemo{
public static void main(String[] args){
int[] numbers = {10,20,30,40,50};
//遍历数组元素
for(int x:numbers){
System.out.println(x);
}
}
}
输出得到
10
20
30
40
50
等价于python的:for i in numbers
评论(0)