Which of the following are valid array declarations/definitions? 1: int iArray1[10]; 2: int iArray2[]; 3: int iArray3[] = new int[10]; 4: int iArray4[10] = new int[10]; 5: int []iArray5 = new int[10]; 6: int iArray6[] = new int[]; 7: int iArray7[] = null; A) 1. B) 2. C) 3. D) 4. E) 5. F) 6. G) 7. The Ans given is b,c,e,g.But i choose b,c,g.e is invalid since no dimension for array is specified which results in compiler error. Thanks!
Dd R
Greenhorn
Joined: Jul 23, 2000
Posts: 2
posted
0
Hi, E is the fifth line and it has dimension on the right hand side and it is correct. so no wrong with the majji's answer. thanks, dd
Originally posted by avn: Which of the following are valid array declarations/definitions? 1: int iArray1[10]; 2: int iArray2[]; 3: int iArray3[] = new int[10]; 4: int iArray4[10] = new int[10]; 5: int []iArray5 = new int[10]; 6: int iArray6[] = new int[]; 7: int iArray7[] = null; A) 1. B) 2. C) 3. D) 4. E) 5. F) 6. G) 7. The Ans given is b,c,e,g.But i choose b,c,g.e is invalid since no dimension for array is specified which results in compiler error. Thanks!