流程控制-增强For循环

增强For循环

  • 数组的创建: int[] numbers = {10,20,30,40,50};

代码

package com.frey.struct;

public class For03 {
    public static void main(String[] args) {
        int[] numbers={10,20,30,40,50};     //定义了一个数组

        //遍历数组的元素
        for (int x:numbers)
        {
            System.out.println(x);
        }
    }
}

posted @ 2021-12-07 20:52  梧桐灯下江楚滢  阅读(26)  评论(0编辑  收藏  举报