主要是用来循环数组和集合的
package com.chan.struct; public class ForDemo05 { public static void main(String[] args) { int[] numbers = {10,20,30,40,50}; //定义了一个数组 // 遍历数组的元素 for(int x:numbers){ System.out.println(x); } } }
主要是用来循环数组和集合的
package com.chan.struct; public class ForDemo05 { public static void main(String[] args) { int[] numbers = {10,20,30,40,50}; //定义了一个数组 // 遍历数组的元素 for(int x:numbers){ System.out.println(x); } } }