1z0-829 Exam QuestionsBrowse all questions from this exam

1z0-829 Exam - Question 9


Given:

Which statement is true while the program prints GC?

Show Answer
Correct Answer: BD

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

3 comments
Sign in to comment
SampsOption: D
Feb 16, 2024

t1 is eligible for garbage collection

minhdevOption: D
May 5, 2024

D is correct t1 is eligible to GC

UtemanOption: D
Jul 2, 2024

D is correct