Re: Changing the value of Boolean?

From: Alex Hunsley (lard_at_tardis.ed.ac.molar.uk)
Date: 02/20/04


Date: Fri, 20 Feb 2004 15:56:45 +0000

Blueyonder wrote:
> Sure I've read somewhere (but can't find it now) that you cannot change the
> value of a Boolean tyep variable. You have to set it each time like this -
>
> ////////////////////////////////////////////////////////////
> Boolean b = new Boolean(true);
>
> b = new Boolean(false);
> ////////////////////////////////////////////////////////////
>
> Is this correct?
>
> thanks
>
> harry

Yup. If you look at the API doc for boolean, you can see that it is
immutable (i.e. can't be changed once you've made it).

Please post simpler questions like this to comp.lang.java.help btw, as
it's more suited...

alex



Relevant Pages