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); } } }
结果:
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); } } }
结果: