FileDocCategorySizeDatePackage
WeakRefTest.javaAPI DocExample729Tue May 16 12:28:22 BST 2000tuning.reuse

WeakRefTest

public class WeakRefTest extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    try
    {
      Reference ref1 = new WeakReference(new Integer(5));
      Reference ref2 = new SoftReference(new Integer(6));
      System.out.println(ref1 + " : " + ref1.get());
      System.out.println(ref2 + " : " + ref2.get());

      int REPEAT = args.length > 0 ? Integer.parseInt(args[0]) : 10000000;
      Integer ic;
      for (int i = 0; i < REPEAT; i++)
        ic = new Integer(i);
      System.out.println(ref1 + " : " + ref1.get());
      System.out.println(ref2 + " : " + ref2.get());
    }
    catch(Exception e){e.printStackTrace();}