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?
(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
b ... View full answer
Get step-by-step solutions from verified subject matter experts
