9 数组2 for-each 增强型循环

package com.wys.java;

public class foreachDemo {
    public static void main(String[] args) {
        double[] myList = {1.0, 2.0, 3.0, 4.0, 5.0};
        //用for_each 输出所有元素
        for(double element: myList){
            System.out.println(element);
        }
    }
}

结果:

9 数组2  for-each 增强型循环

相关推荐