1.静态初始化
int[] array = {1, 2, 3, 4};
2.动态初始化
int[] array = new int[3];
3.获取数组长度
int ll = array.length;
数组一旦创建,程序运行期间,长度不能改变
4.遍历数组
for (int i = 0; i < array.length; i++) {
System.out.println(array[i]);
}
原文:https://www.cnblogs.com/howmanyk/p/14479701.html