Given:
Which statement is true while the program prints GC?
Given:
Which statement is true while the program prints GC?
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.
t1 is eligible for garbage collection
D is correct
D is correct t1 is eligible to GC