phantom-reference

Java: difference between strong/soft/weak/phantom reference

醉酒当歌 提交于 2019-11-26 06:09:56
问题 I have read this article about the topic, but I don\'t really understand it. Please give me some advice along with examples when describing the concepts. 回答1: Java provides two different types/classes of Reference Objects : strong and weak . Weak Reference Objects can be further divided into soft and phantom . Let's go point by point. Strong Reference Object StringBuilder builder = new StringBuilder(); This is the default type/class of Reference Object, if not differently specified: builder