Java中的四種引用方式

1.強引用( Strong Reference ) ➢最普遍的引用:       代碼中的object和str都是強引用: Object object = new Object(); String str = "hello"; ➢拋出OutOfMemoryError終止程序也不會回收具有強引用的對象 ➢通過將對象設置爲null來弱化引用,使其被回收   2.軟引用( Soft Reference
相關文章
相關標籤/搜索