A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
video training course this week in the
Boolean vs boolean
Joined: Jul 05, 2001
Aug 02, 2001 12:06:00
Can someone help me understand why I have an error that says "Type mismatch cannot convert from Boolean to boolean".
Confused about Boolean and boolean.
Joined: Sep 29, 2000
Aug 02, 2001 12:14:00
A boolean is a primitive. A Boolean is an object that does nothing other than hold a boolean so you can deal with those things that are so picky that they only hold Objects.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: May 10, 2001
Aug 02, 2001 15:09:00
I am assuming you have a Boolean that you need to get into a boolean. You can use the booleanValue method in the Boolean class. It takes a Boolean object and returns the value of it as a boolean. Something like this:
... Boolean wrappedB = new Boolean("true"); boolean b = wrappedB.booleanValue(); // the boolean b now has the value true ...
hope that helps
did I say boolean/boolean enough in that post?
I agree. Here's the link:
subject: Boolean vs boolean
Difference using "=" vs "+="
[ ] vs .
Inner Classing vs. Subclassing
GET vs POST-Doubt
Cannot assign generic object reference to similar type.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015