java garbage collection and null reference

前端 未结 6 1785
梦谈多话
梦谈多话 2020-12-20 05:27

In my studying for OCJP I came across the following question:

class CardBoard {
           Short story = 200;
           CardBoard go(CardBoard cb) {
                


        
6条回答
  •  无人及你
    2020-12-20 06:16

    c3 is a local handle with a null reference, it does not point (and hever has pointed) to an allocated object. Therefore there's nothing to GC.

提交回复
热议问题