Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

K&B bk,question regarding Boolean Wrapper Class

 
Vishy Karl
Ranch Hand
Posts: 116
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
ie.
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.
Thanks,
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
Bert
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: )
 
Johannes de Jong
tumbleweed
Bartender
Posts: 5089
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice deep one Vishy. Heck were are the days when I tought things trough so well. I feel sooo old sometimes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic