增强for循环

jdk5引入的一种主要用于数组或集合的增强型for循环

package com.le.base;

public class demo12 {
    public static void main(String[] args) {
        int number[] ={10,20,30,40,50};
        //遍历数组的元素
        for(int x:number){
            System.out.println(x);
        }
    }
}
posted @ 2022-02-11 20:38  勤学码虫  阅读(13)  评论(0)    收藏  举报