aspose file tools*
The moose likes Beginning Java and the fly likes Harry Potter's Miracle in Boolean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Harry Potter Watch "Harry Potter New topic
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: 4387
    
    8

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: 18829
    
  40

saloni jhanwar wrote:
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



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: 18829
    
  40

saloni jhanwar wrote:



JavaRanch automatically links to the latest JavaDoc -- for example.... java.lang.Boolean.

Henry
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38788
    
  23
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: 1776
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: 3014
    
  10
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: 1776
I agree to that, Mike.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38788
    
  23
Agree with Mike S; the parseBoolean() method has been around for nearly eight years, and even I have used it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Harry Potter's Miracle in Boolean