Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Wrapper class Problem

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SCJP1.6 JAVA 6 CERTIFICATION Guide-310-065
Using Wrapper Conversion Utilities (Exam Objective 3.1) pg-243

TABLE-3.3






i tried these 2 statements in java and they did run.But,in SCJP 6 by kathy sierra,it's mentioned(TABLE-3-3) that no such functions exist for character and boolean .




 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you quote the exact statement made in the book. And did you check the errata just in case ?
 
Ankit Garg
Sheriff
Posts: 9509
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well in the book, the valueOf method in Boolean column is marked as "s" which means it can take a String only. And the valueOf method of Character is not marked because it doesn't take a String or number, it takes a char, that table only lists valueOf method which takes String or a number...
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Garg wrote:Well in the book, the valueOf method in Boolean column is marked as "s" which means it can take a String only. And the valueOf method of Character is not marked because it doesn't take a String or number, it takes a char, that table only lists valueOf method which takes String or a number...


In that table, she/he indicates static with the letter s, not String... It's mentioned above the table.. With that, there is a n means NumberFormatException(NFE)..
 
Sahil Kapoor
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you check the API , you would find both methods legitimate.

 
Ankit Garg
Sheriff
Posts: 9509
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that table, she/he indicates static with the letter s, not String... It's mentioned above the table.. With that, there is a n means NumberFormatException(NFE).

Oops, I didn't see the table carefully. The Boolean.parseXxx not being marked in that table has been pointed out before (and mentioned in the errata thread here). For Character.valueOf, it might not have been marked because it doesn't take a String as at the bottom of the table it mentions valueOf(String) method...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic