<b>(a)</b> public class Bar { ... private Foo myFoo = new Foo(); ... } <b>(b)</b> public class Bar { ... private SoftReference myFooRef = new SoftReference(new Foo()); ... }
Example 1: (a) A typical class Bar that includes a reference to an object Foo; (b) the same class holding a SoftReference to its Foo.