From: "Geoff Bull" <[log in to unmask]>
> > a = 1;
> > b = a;
> > a = a+1;
> > what does b equal?
> > In Java:
> > if b is the primitive "int", then b=a-1
> > if b is the class "Integer" then b = a means in Ada terms b renames a.
> > we can thank C.
> But b must have been a primitive, because operators only work for
> (except for "+" for catenating Strings).
> Have I missed something?
Of course you're right. As they say in the classics, DOH!
My example was too simple, I was careless, should have had a = f(a) not a=
where the signature of f is not immediately visible (to humans, rather than
The problem I was attempting to illustrate is the somewhat counter-intuitive
=, where on a Class it's a rename, on a primitive it's an assignment of
Similarly for a==b, where in java you're saying "are a and b just aliases
for the same object"
rather than comparing their internal values. Which is done with a.equals(b),
Mea Culpa in any event. Thanks for the correction and peer review.