nerdexam
GIAC

GSSP-JAVA · Question #75

GSSP-JAVA Question #75: Real Exam Question with Answer & Explanation

The correct answer is D. Line 20. See the full explanation below for the reasoning.

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

Community Discussion

No community discussion yet for this question.

Full GSSP-JAVA Practice
You have the following code fragment of a Java program named test.... | GSSP-JAVA Q#75 Answer | NerdExam