Home » Java Programming » Garbage Collections

After line 8 runs. how many objects are eligible for garbage collection? public class X { public static void main(String [] args) { X x = new X(); X x2 = m1(x); /* Line 6 */ X x4 = new X(); x2 = x4; /* Line 8 */ doComplexStuff(); } static X m1(X mx) { mx = new X(); return mx; } }

← Previous Next →

Discussion & Comments

No comments yet. Be the first to comment!