M
Matt
when we pass an array as a function argument, we do this:
printArray(new int[] {4,5,6}); //good
OR
int [] a = {4,5,6};
printArray(a); //good
However, if we declare an array of integers like this, it will yield compile error:
int [] a = new int {1,2,3}; //compile error
what's the rationales? please advise. thanks!!
printArray(new int[] {4,5,6}); //good
OR
int [] a = {4,5,6};
printArray(a); //good
However, if we declare an array of integers like this, it will yield compile error:
int [] a = new int {1,2,3}; //compile error
what's the rationales? please advise. thanks!!