Paul and Craig

I am getting what I expect with the following code (see below), thanks
to Craig, but not with the code which you can find at
http://131.191.32.112:8080/classes.zip and I am not sure what the
difference is.  Essentially, I am trying to keep a WeakReference to
Point classes so that when I update the Point.class I can change the
classes for all the PointImpl objects out there.  Not sure what is
going wrong.  If you could take a peek, that would be great.  Thanks.

Jack

package com.crackwillow.deploy;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

public class MyReference {
  public static void main(String [] params) {
    CheckPlease cp = new CheckPlease();
    cp.setBill("1.01");
    WeakReference wr = new WeakReference(cp);
    ((CheckPlease)((Reference)wr).get()).setBill("5.03");
    System.out.println(cp);
  }
}

class CheckPlease {
  private String bill = "0.00";

  public void setBill(String add) {
    if(add == null) add = "freebee";
    else bill += " + " + add;
  }

  public String getBill() {
    return bill;
  }

  public String toString() {
    return bill;
  }
}



"You can't wake a person who is pretending to be asleep."

~Native Proverb~

"Each man is good in His sight. It is not necessary for eagles to be crows."

~Hunkesni (Sitting Bull), Hunkpapa Sioux~

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to