• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Wrapper class Problem

 
Ranch Hand
Posts: 634
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .




 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you quote the exact statement made in the book. And did you check the errata just in case ?
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)..
 
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you check the API , you would find both methods legitimate.

 
Ankit Garg
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Everybody! Do the Funky Monkey! Like this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic