for增强

package study5ran2yl.study;

public class ForDemo02 {
    public static void main(String[] args) {
        int[] number={1,2,3,4,5};
        //java定义了一个数组
        for (int i = 0; i < 5; i++) {
            System.out.print(number[i]);
        }
        System.out.println();
        System.out.println("=============");
        //for增强,遍历数组元素,程序员偷懒必备
        for(int x:number){
            System.out.print(x);
        }
    }
}

  

posted @ 2022-04-26 19:01  回忆也交给时间  阅读(9)  评论(0编辑  收藏  举报