GIAC
GSSP-JAVA · Question #75
You have the following code fragment of a Java program named test. 12. public void getData(){ 13. ArrayList numbers=new ArrayList(); 14. for(int i=0; i<10;1++){ 15. int value=i*((int i)…
Sign in or unlock GSSP-JAVA to reveal the answer and full explanation for question #75. The question stem and answer options stay visible for context.
Question
You have the following code fragment of a Java program named test. 12. public void getData(){ 13. ArrayList numbers=new ArrayList(); 14. for(int i=0; i<10;1++){ 15. int value=i*((int i) Math.random()); 16. Integer obj=new Integer(value); 17. numbers.add(obj); 18. } 19. System.out.println(numbers); 20. } On which of the following lines of code will the object referenced by obj be eligible for garbage collection?
Options
- ALine 18
- BLine 19
- CLine 17
- DLine 20
Unlock GSSP-JAVA to see the answer
You've previewed enough free GSSP-JAVA questions. Unlock GSSP-JAVA for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.