10、增强for循环

在这里插入图片描述

package com.wzt.www.struct;

/**
 * @author WZT
 * @create 2021-03-25 21:31
 */
public class ForDemo05 {
    
    
    public static void main(String[] args) {
    
    
        int[] numbers = {
    
    10,20,30,40,50};
        for (int i = 0; i < 5; i++) {
    
    
            System.out.println(numbers[i]);

        }

        System.out.println("=============================");
          //遍历数组元素
        for (int x:numbers){
    
    
            System.out.println(x);
        }
    }



}

输出

10
20
30
40
50
=============================
10
20
30
40
50

Process finished with exit code 0

猜你喜欢

转载自blog.csdn.net/weixin_45809838/article/details/115219484