Originally posted by yogi maheshnath:
Hi,
Which two create an instance of an array? (Choose two)
Answer: A, D
How option D is creating an instance of Array.Please Explain.
Thanks,
A. int[] ia = new int[15];
B. float fa = new float[20];
C. char[] ca = �Some String�;
D. Object oa = new float[20];
E. int ia[][] = { 4, 5, 6, }, { 1, 2, 3 };
I understand the following from the above choices
A. int[] ia = new int[15] -> This is correct
B. float fa = new float[20] -> This is incorrect, missing box brackets, the correct definition is
float[] fa = new float[20],
C. char[] ca = "Some String"
Please explain
D. Object oa = new float[20];
Please explain
E. int ia[][] = { 4, 5, 6, }, { 1, 2, 3 }; - > It should be declared like this ...
int[][] multiD = {
{ 1, 2, 3, 4 },
{ 5, 6, 7 }
};
Thanks