The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes K&B bk,question regarding Boolean Wrapper Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "K&B bk,question regarding Boolean Wrapper Class" Watch "K&B bk,question regarding Boolean Wrapper Class" New topic

K&B bk,question regarding Boolean Wrapper Class

Vishy Karl
Ranch Hand

Joined: Sep 08, 2003
Posts: 116
Hi all,
In K&B bk on pg 378(Indian Edition)-2nd paragraph it is given that

" The constructors for the Boolean wrapper class take either a boolean value true or false, or a case-insensitive String with the value "true" or "false"........... "

Now my question is that in fact the constructor of Boolean class takes any string as argument and not just "true" or "false".
The only thing is that if the String is other than "true" then the newly created Boolean wrapper object will be initialized to false.
Boolean thisworks = new Boolean("abcde");
System.out.println(thisworks); //prints false
So should this not be corrected in the book ???
I hope Kathy and Bates take this into consideration too and correct the statement in the book.

"The man who can drive himself further once the effort gets painful is the man who will win." <br />Roger Bannister
Bert Bates

Joined: Oct 14, 2002
Posts: 8898
Hi Vishy -
I think we will clarify that statement in the book, thanks for the input.
I want to ask everybody again.... please email us if you have an idea for our book!
We sometimes miss threads on this forum, and we won't miss any emails you send us!
p.s. As an added benefit, if you email us, then you get your name listed in future printings of the book! (if you want :roll: )

Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Johannes de Jong

Joined: Jan 27, 2001
Posts: 5089
Nice deep one Vishy. Heck were are the days when I tought things trough so well. I feel sooo old sometimes.
I agree. Here's the link:
subject: K&B bk,question regarding Boolean Wrapper Class
It's not a secret anymore!