class HappyGarbage01 { public static void main(String args[]) { HappyGarbage01 h = new HappyGarbage01(); h.methodA(); /* Line 6 */ } Object methodA() { Object obj1 = new Object(); Object [] obj2 = new Object[1]; obj2[0] = obj1; obj1 = null; return obj2[0]; } } Where will be the most chance of the garbage collector being invoked? - Study24x7
Social learning Network
09 Mar 2023 06:32 PM study24x7 study24x7

class HappyGarbage01 { public static void main(String args[]) { HappyGarbage01 h = new HappyGarbage01(); h.methodA(); /* Line 6 */ } Object methodA() { Object obj1 = new Object(); Object [] obj2 = new Object[1]; ...

See more

A

After line 9

B

After line 10

C

After line 11

D

Garbage collector never invoked in methodA()

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