1 package com.xl.struct; 2 3 public class ForDemo05 { 4 public static void main(String[] args) { 5 int[] numbers = {10,20,30,40,50};//定义了一个数组 6 for (int i= 0;i<5;i++){ 7 System.out.println(numbers[i]); 8 } 9 System.out.println("==========="); 10 11 //遍历数组的元素 12 for (int x:numbers){ 13 System.out.println(x); 14 } 15 } 16 }