Re: Why String is Immutable?
- From: Dimitri Maziuk <dima@xxxxxxxxx>
- Date: Tue, 4 Oct 2005 19:27:08 +0000 (UTC)
Brendan Guild sez:
> Tim Tyler wrote in news:Inu9Bw.D1u@xxxxxxxxxx:
>
>> Brendan Guild <dont@xxxxxxx> wrote or quoted:
>>> Tim Tyler wrote in news:InsoHw.FpG@xxxxxxxxxx:
>>> > Brendan Guild <dont@xxxxxxx> wrote or quoted:
>>> >> What mutable version of Double do you mean? [...]
>>
>>> > I mean double - as in:
>>> >
>>> > double d = 2.0;
>>> > d = d * d;
>>> >
>>> > I regard double variables as mutable.
>>> >
>>>
>>> [...] I certainly agree that double variables are mutable. I had
>>> considered that you might have meant double variables but rejected
>>> it because Double variables are also mutable in exactly the same
>>> way.
>>
>> java.lang.Double objects are immutable.
>
> I mean Double variables - as in:
>
> Double d = new Double(2.0);
> d = new Double(d.doubleValue() * d.doubleValue());
>
> I regard Double variables as mutable, considering this one started as
> 2.0 and ended up as 4.0.
Wow. I've got to add this to my signature collection.
Dima
--
.... If you want to make sure you don't put a Pig in a List of airplanes and
have it fail at insertion rather than extraction, use
planelist.add((Airplane)o) instead of planelist.add(o). It's that easy.
-- Mark 'Kamikaze' Hughes
.
- References:
- Re: Why String is Immutable?
- From: Brendan Guild
- Re: Why String is Immutable?
- From: Tim Tyler
- Re: Why String is Immutable?
- From: Brendan Guild
- Re: Why String is Immutable?
- Prev by Date: Re: why program to interface is better design?
- Next by Date: Re: binary array to byte type?
- Previous by thread: Re: Why String is Immutable?
- Next by thread: Re: Why String is Immutable?
- Index(es):
Relevant Pages
|
|