aspose file tools*
The moose likes Beginning Java and the fly likes Can you set the value of a Boolean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Can you set the value of a Boolean?" Watch "Can you set the value of a Boolean?" New topic
Author

Can you set the value of a Boolean?

Rick Crawford
Ranch Hand

Joined: Aug 17, 2001
Posts: 34
Question: is it possible to set the value of a Boolean after it has already been constructed?
For example, suppose I create my Boolean like this:
Boolean myBoolean = new Boolean(false);
..then later on in the code, I need to reset the value:
if (x == y) {
// Based on this condition, I need to set the booleanValue within the object to Boolean.TRUE
}
Thanks for any assistance,
Rick <><

------------------
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Wrapper classes like Boolean and the others are immutable, i.e. we cannot change the value they hold after having created them. The only thing you can do is create a new Boolean object and assign it to myBoolean.
HIH
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Rick Crawford
Ranch Hand

Joined: Aug 17, 2001
Posts: 34
Thanks so much for the info.
This list is absolutely the greatest! I look forward to the day that I can actually help instead of always being the one that is helped!
Rick <><
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
By being helped sometimes we do help Maybe others have the same question and now don't need to ask. Or we read a question and answer and file it away for later use.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can you set the value of a Boolean?