Question: At what point is the Bar object, created on line 6, eligible for garbage collection? (a) After line 8 (b) After line 9 (c) After

At what point is the Bar object, created on line 6, eligible for garbage collection?class Test { String f() { String s = new String(); /* Line 3 */ return s; } public static void main (String

(a) After line 8

(b) After line 9

(c) After line 4, when f() completes

(d) After line 10

class Test { String f() { String s = new String(); /* Line 3 */ return s; } public static void main (String args[]) { Test t = new Test (); /* Line 7 */ String s1t.f(); /* Line 8 */ s1= new String(); /* Line 9 */ System.out.println (sl); } }

Step by Step Solution

3.47 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

b ... 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!