(a)
  public class Bar {
    ...
    private Foo myFoo = new Foo();
    ...
}

(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.

Back to Article