class Test { private Demo d; void start() { d = new Demo(); this.takeDemo(d); /* Line 7 */ } /* Line 8 */ void takeDemo(Demo demo) { demo = null; demo = new Demo(); } } When is the Demo object eligible for garbage collection? - Study24x7
Social learning Network
study24x7

Default error msg

Login

New to Study24x7 ? Join Now
Already have an account? Login
09 Mar 2023 06:39 PM study24x7 study24x7

class Test { private Demo d; void start() { d = new Demo(); this.takeDemo(d); /* Line 7 */ } /* Line 8 */ void takeDemo(Demo demo) { demo = null; demo = new Demo(); } } When is the Demo object eligible for garbage collection?

A

After line 7

B

After line 8

C

After the start() method completes

D

When the instance running this code is made eligible for garbage collection.

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles