wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Wrapper class Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Wrapper class Problem" Watch "Wrapper class Problem" New topic
Author

Wrapper class Problem

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

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 .





OCPJP 6.0 93%
OCPJWCD 5.0 98%
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Can you quote the exact statement made in the book. And did you check the errata just in case ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

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)..


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Sahil Kapoor
Ranch Hand

Joined: Sep 12, 2009
Posts: 316
If you check the API , you would find both methods legitimate.


SCJP 6.0 96%

(Connecting the Dots ....)
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Wrapper class Problem
 
Similar Threads
Wrapper classes
Doubt in Boolean and Character class
K&B error page 380
valueOf() method for Character Wrapper Class
booleanValue()--help needed-exam in 2 days