数组定义

package com.shuzu;

public class demo02 {
public static void main(String[] args) {
//静态初始化
int[] a = {1,3,4,5};
System.out.println(a[1]);
//动态初始化
int[] b = new int[10];
b[0] = 1;
b[1] = 31;
b[2] = 11;
b[3] = 21;
b[4] = 21;
b[5] = 1;
b[6] = 121;
b[7] = 1;
b[8] = 1;
b[9] = 3;
System.out.println(b[6]);

}
}
posted @ 2022-05-08 15:18  小松2739  阅读(13)  评论(0编辑  收藏  举报