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](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1704/7/8/6/742659cfb36c25611704786741579.jpg)
(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
Get step-by-step solutions from verified subject matter experts
