Another way of putting my question, maybe, is: why do these == return
different values:
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);
System.out.println("(cp == (CheckPlease)wr.get()): " + (cp ==
(CheckPlease)wr.get()));
cp = new CheckPlease();
System.out.println("(cp == (CheckPlease)wr.get()): " + (cp ==
(CheckPlease)wr.get()));
}
}
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;
}
}
On Thu, 2 Dec 2004 10:18:33 -0800, Dakota Jack <[EMAIL PROTECTED]> wrote:
> On Thu, 2 Dec 2004 00:05:12 -0800, Craig McClanahan <[EMAIL PROTECTED]> wrote:
> > Don't forget that Strings are immutable in Java :-).
> >
> > You might have better luck experimenting with a JavaBean that has
> > getters/setters for the properties you want to be able to mess with.
> >
> > Craig
> >
> >
>
> Thanks, Craig:
>
> You are right. I definitely should "unmuddy" the waters here. Thanks, again.
>
> Jack
>
>
>
>
> "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~
>
--
"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]