Question: After line 8 runs, how many objects are eligible for garbage collection? (a) 0 (b) 1 (c) 2 (d) 3 public class X { public

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 4 */ X X4

(a) 0

(b) 1

(c) 2

(d) 3

public class X { public static void main(String[] args) { X X = new X(); X x2 = m1 (x); /* Line 4 */ X X4= new X(); x2 = x4; /* Line 6 */ doComplexStuff (); } } static X m1 (X mx) { mx = new X(); return mx; }

Step by Step Solution

3.47 Rating (160 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!