Java Q&A
by Art Jolin


Example 1:

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

(b)
   public class Bar {
     ...
     private SoftReference myFooRef = new SoftReference(new Foo());
     ...
}

Example 2:

public void someMethod()  {
	Foo myFoo = myFooRef.get();
	If (myFoo == null)
		.....recreate myFoo, skip it, do whatever is right...
	else {
	UsefulData data = myFoo.getUsefulData();
		...
		MyFoo.doSomethingElseUseful();
	...
}
return;
}





1

