| Author |
Harry Potter's Miracle in Boolean
|
saloni jhanwar
Ranch Hand
Joined: Feb 09, 2012
Posts: 583
|
|
Whereas I know there are only six parseXxx() methods for numeric type of primitives.
There is no method for Boolean class then how thiscode is working and printing even true
Output:true
|
Tell the difficulties that i am difficult.
|
 |
Matthew Brown
Bartender
Joined: Apr 06, 2010
Posts: 3795
|
|
|
What makes you think the method doesn't exist? It's there in the documentation.
|
 |
saloni jhanwar
Ranch Hand
Joined: Feb 09, 2012
Posts: 583
|
|
Matthew Brown wrote:What makes you think the method doesn't exist? It's there in the documentation.
http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Boolean.html
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16695
|
|
The parseBoolean() method was added with Java 5.... perhaps you should use a version of the JavaDoc that matches the version of Java that you are using.
Henry
|
 |
saloni jhanwar
Ranch Hand
Joined: Feb 09, 2012
Posts: 583
|
|
|
 |
saloni jhanwar
Ranch Hand
Joined: Feb 09, 2012
Posts: 583
|
|
I got confuse becaude even K&B showing no parseXxx method for Boolean and Character class.
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16695
|
|
saloni jhanwar wrote:
JavaRanch automatically links to the latest JavaDoc -- for example.... java.lang.Boolean.
Henry
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32708
|
|
|
How old is your book? Have a look through all those classes for valueOf methods, and I think you will find more than there are in your table.
|
 |
saloni jhanwar
Ranch Hand
Joined: Feb 09, 2012
Posts: 583
|
|
Campbell Ritchie wrote:How old is your book? Have a look through all those classes for valueOf methods, and I think you will find more than there are in your table.
My book is new, i have K&B 6,and that snap was from k&b 6.
|
 |
John Jai
Bartender
Joined: May 31, 2011
Posts: 1778
|
|
If you feel it's an mistake in the book, you can log an entry here - http://www.coderanch.com/t/467890/java-programmer-SCJP/certification/Compiling-errata-SCJP
But it looks okay to me as the authors have clearly mentioned in the picture title - "Common Wrapper Conversion Methods" and not "All".
|
 |
Mike Simmons
Ranch Hand
Joined: Mar 05, 2008
Posts: 2782
|
|
John Jai wrote:But it looks okay to me as the authors have clearly mentioned in the picture title - "Common Wrapper Conversion Methods" and not "All".
Hmmm, I don't buy that. It would be fine if they simply didn't mention parseXxx at all - then your argument would apply. But they do have a row for the parseXxx methods - and on that row, an X is supposed to indicate the method exists, and a lack of an X indicates it does not. The table was correct for an earlier version of Java, but it looks like that new parse method was overlooked for the last two editions of the book. At least one valueOf() method was overlooked as well. Maybe more.
|
 |
John Jai
Bartender
Joined: May 31, 2011
Posts: 1778
|
|
|
I agree to that, Mike.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32708
|
|
Agree with Mike S; the parseBoolean() method has been around for nearly eight years, and even I have used it
|
 |
 |
|
|
subject: Harry Potter's Miracle in Boolean
|
|
|