I guess the thing you are about to read will be bugging for those who reply. please refer to kathy book pg:233, they have given a table mentioned WRAPPER CONVERSION METHODS and there are lot of stuff in it. i really could not interpret the table. can anyone explain me how to read that table.
The wrapper classes are listed across the top of the table. Each column shows whether that wrapper has the methods listed down the left side of the table. The parseXxx methods refer to the static methods which convert a String to a the primitive type associated with that wrapper. The Xxx is the primitive type that is returned (only capitalized to fit the Java naming conventions). If you are looking at the Float column, the method would be parseFloat(); If you are looking at the Integer column, the method would be parseInt(). If the wrapper has that method, there will be an "X" in the appropriate row for that column. So if you look at the row for the method doubleValue(), you will see that the Boolean wrapper class does not have that method, but the Byte wrapper class does.
[As an aside, the Java 6 version of K&B is out and has sufficient revisions to make the page numbers different. It would be helpful to note which edition of the book you are referencing.]
Joined: Aug 03, 2008
Thank you Mr.Jamie i have understood a portion of the table.. but how about parseXxx (with radix), i do not know what is radix, also they have given as 'n' over there. do they imply that the method throws numberformatexception???(pg:233 in kathy 1.5 book ).also please let me know whether we have to memorise all the stuff given in that table??
If you look at the section entitled parseXxx() and valueOf() 2 pages before the table it shows some more examples of using parseXxx with a radix and also mentions throwing a NumberFormatException if the String argument is not properly formed. The String is not a properly formed number if it contains any character that does not comprise a number of the specified radix (or a decimal--base 10--number is no radix is specified). So a string containing the letter "z" would always cause the exception, and a string with a "3" would cause the exception if the radix were 2 since binary numbers contain only "0" and "1".
Joined: Aug 01, 2008
hi all, My first post, now my second post =) I was read javaranch but never post. Interesting explanation Jamie... Thanks a lot..
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com