数组-三种初始化

三种初始化

  • 课堂截图
    picture

代码

package com.frey.array;

public class Demo02 {
    public static void main(String[] args) {
        //静态初始化:创建+赋值
        int[] a={1,2,3,4,5,6,7};
        System.out.println(a[0]);

        //动态初始化:包含默认初始化
        int[] b= new int[10];
        b[0]=99;
        System.out.println(b[0]);
    }
}

posted @ 2021-12-10 19:43  梧桐灯下江楚滢  阅读(22)  评论(0编辑  收藏  举报