Exam 1z0-829 All QuestionsBrowse all questions from this exam
Question 9

Given:

Which statement is true while the program prints GC?

    Correct Answer: B

    In the given code, t1 is initially assigned a new App object with the name 't1', and t2 is assigned a new App object with the name 't2'. When t1 is set to t2, both t1 and t2 reference the same App object with the name 't2'. After setting t1 to null, t2 still references the App object with the name 't2'. The App object with the name 't1' is not referenced anymore and is eligible for garbage collection, but the object referenced by t2 is not eligible for garbage collection. Thus, only the first App object is eligible for garbage collection.

Discussion
SampsOption: D

t1 is eligible for garbage collection

UtemanOption: D

D is correct

minhdevOption: D

D is correct t1 is eligible to GC