增强For循环

 

 

 

 1 package com.lin.struct;
 2 //主要用于数组和集合
 3 public class ForDemo5 {
 4     public static void main(String[] args) {
 5         int[] numbers={10,20,30,40,50};//定义了一个数组
 6 
 7         for (int i = 0; i < 5; i++) {
 8             System.out.println(numbers[i]);
 9         }
10         System.out.println("=================");
11         for(int x:numbers){
12             System.out.println(x);
13         }
14     }
15 }

 

posted @ 2021-02-13 12:59  奔啵儿灞  阅读(52)  评论(0)    收藏  举报