数组

//方法1
int array1[] = {1,2,3,4};
//方法2
int[] array2 =new int[5];
//方法3
byte array3= new byte[]{1,2,3,4};  

例:

结果输出3个0,因为虽然为score开辟了3个内存空间,但并未为其赋值,int的默认值是0,所以输出3个0

第一个for循环为其每个下标赋值,第二个for循环输出每个下标的值,结果为1,2,3

数组的应用

原文地址:https://www.cnblogs.com/sflik/p/4486241.html