Question: When is the object B in the following code eligible for garbage collection? (a) After line 5 (b) After line 6 (c) After line 7

When is the object B in the following code eligible for garbage collection?void start () { A a new A(); Bb = new B (); a.s (b); = b = null; /* Line 5 */ a = null; /* Line 6 */

(a) After line 5

(b) After line 6

(c) After line 7

(d) There is no way to be absolutely certain.

void start () { A a new A(); Bb = new B (); a.s (b); = b = null; /* Line 5 */ a = null; /* Line 6 */ System.out.println("start completed"); /* Line 7 */

Step by Step Solution

3.38 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

d There ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Advanced Java Programming Questions!