Contents |
The Reference Objects API consists of the classes listed below and shown in the class hierarchy diagram on the right.
To explain how to use the Reference Objects API classes in a program and the resulting behavior of the garbage collector, this lesson covers the following topics:
The
java.lang.ref.Reference
java.lang.ref.SoftReference
java.lang.ref.WeakReference
java.lang.ref.PhantomReference
java.lang.ref.ReferenceQueue
java.util.WeakHashMap
SoftReference
,WeakReference
, andPhantomReference
classes define three kinds of Reference objects and three strengths of object reachability. From strongest to weakest, the strengths of reachability are the following:
- Strongly reachable
- Softly rechable
- Weakly reachable
- Phantomly reachable
- Unreachable
Contents |