recherche

Maison  >  Questions et réponses  >  le corps du texte

java - 哪一行代码的obj符合垃圾收集器的收集标准?

        Object aobj=new Object();
        Object bobj=new Object();
        Object cobj=new Object();
        aobj=bobj;
        aobj=cobj;
        cobj=null;
        aobj=null;

求解释一下为什么只有最后一行最后一行么^ . ^
那么之后在什么情况下,a、b obj 开始new的内存空间才会被回收

黄舟黄舟2866 Il y a quelques jours660

répondre à tous(1)je répondrai

  • PHPz

    PHPz2017-04-17 13:33:38

    是否被引用只是检测对象的指标,显式置为NULL会帮助GC标记对象,具体什么时候去回收,要根据具体的GC策略

    répondre
    0
  • Annulerrépondre