Given:
1. import java.util.*; 2. public class Main { 3. public static void main(String[] args) { 4. ArrayList[] ls = new ArrayList[3]; 5. for(int i = 0; i < 3; i++) { 6. ls[i] = new ArrayList(); 7. ls[i].add("a" + i); 8. } /*from w w w. j a v a2 s. c o m*/ 9. Object o = ls; 10. do3(ls); 11. for(int i = 0; i < 3; i++) { 12. // insert code here 13. } 14. } 15. static Object do3(ArrayList[] a) { 16. for(int i = 0; i < 3; i++) a[i].add("e"); 17. return a; 18. } }
And the following fragments:
If the fragments are added to line 12, independently, which are true? (Choose all that apply.)
C, D, and G are correct.
Fragments III and IV are the correct syntax to cast the Object back to an array of objects.
The references "o" and "ls" refer to the same object, so the changes made to "ls" in do3() are accessible via "o".