Hello!
Found this question at the site:
http://www.examsonline.com and I find it hard to understand why answer D is correct since answer A is wrong. Can anyone please explain to me?
QWhat are valid ways of declaring and initializing arrays? Select all that apply.
A int [ ] arr = new int [5] {1, 2, 3, 4, 5};
Bint arr [5] = new int [ ] {1, 2, 3, 4, 5};
Cint arr [ ] [ ] = new int [5] [ ] {1, 2, 3, 4, 5};
Dint arr [ ] [ ] = new int [5] [5] {{1, 2, 3, 4, 5},
{1, 2, 3, 4, 5}};
Eint [ ] arr [ ] = new int [25];
The correct answers is C, D, E according to the site I mentioned above.
And by the way, I�ve got one more question to you:
I assume that the declaration
int arr [][] = //some code;
means the same as
int[] arr[]= //some code;
Is that correct??
/Linda