How does Garbage Collection in Java work?

后端 未结 9 2161
生来不讨喜
生来不讨喜 2021-02-08 04:36

I was wondering how the garbage collector in Java deals with the following situation.

Object A has a reference to Object B and Object B has a reference to Object C. The

9条回答
  •  走了就别回头了
    2021-02-08 05:40

    You can't count on the garbage collector to work at a specific time,since its behavior is unpredictable,all you can say is that objects B and C are only eligible for garbage collection

提交回复
热议问题