Java:新建数组

Array Initialization

int[] a; = int a[];

int[] a = new int[100]; a[]的值会被初始化为0

`int[] smallPrimes = {2, 3, 5, 7, 11, 13};

new int[] {17, 19, 23, 29, 31, 37};

smallPrimes = new int[] {17, 19, 23, 29, 31, 37} 在不新建数组的情况下重新初始化一个数组变量

int[] anonymous = {17, 19, 23, 29, 31, 37};

Array Copying

int[] luckyNumbers = smallPrimes;
luckyNumbers[5]=12; // now smallPrimes[5] is also 12
int[] copiedLuckyNumbers = Arrays.copyof(luckyNumbers, luckyNumbers.length);