nerdexam
Oracle

1Z0-829 · Question #44

1Z0-829 Question #44: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-829 to reveal the answer and full explanation for question #44. The question stem and answer options stay visible for context.

Java Object-Oriented Approach

Question

Given: public class App{ String name; public App(String name){ this.name = name; } public static void main(String args[]) { App t1 = new App("t1"); App t2 = new App("t2"); t1 = t2; t1 = null; System.out.println("GC"); } } Which statement is true while the program prints GC?

Options

  • AOnly the object referenced by t2 is eligible for garbage collection.
  • BBoth the objects previously referenced by t1 are eligible for garbage collection.
  • CNone of the objects are eligible for garbage collection.
  • DOnly one of the objects previously referenced by t1 is eligible for garbage collection.

Unlock 1Z0-829 to see the answer

You've previewed enough free 1Z0-829 questions. Unlock 1Z0-829 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.

Topics

#object references#garbage collection#memory management#object lifecycle
Full 1Z0-829 Practice