• 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

OCPJP: What do I need to know about wrapper classes?

 
Ranch Hand
Posts: 57
1
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
im preparing for said certification. Sitting around with the JLS and G&S and I'm wondering how deep my knowledge of wrapper classes needs to go. Do I need to know the methods of all eight primitive wrapper classes? Like: Knowing that there's a isSpaceChar method in Character class?

The oracle certification preparation also lists Collection Wrappers. This confuses me since i cannot find a connection between these collection-wrappers and the primitive wrappers. Context: The certification topic is listed as: "Use wrapper classes, autoboxing and unboxing". Can anyone clarify?

Regards,
Bernhard
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When the objectives mention "wrapper" classes, it's referring to the the primitive wrappers eg Integer, Double, Character etc.

I don't think you need to know all the methods in those classes, but at the minimum do know these about wrappers:
*convert from primitive to wrapper and vice versa (eg int to Integer)
*convert from String to wrapper and vice versa
*when using primitives as the generic type in collections (eg list, set, map), it must be the wrapper (eg no such thing as List<int> but List<Integer>)
*know the difference between parseXXX() and valueOf()
*effect of downcasting (same as primitives)


As for collection wrappers, I don't recall the objectives mention it despite the Oracle cert prep talks about it. But such collection wrappers are for special cases like synchronizing the collection. About collections in general, should know what concrete class is thread-safe or not.
 
Bernhard Goetz
Ranch Hand
Posts: 57
1
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your answer! I will add the collections wrapper to my preparation just to be sure.
 
Bernhard Goetz
Ranch Hand
Posts: 57
1
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just got informed that oracle will update the link to the wrapper implementations to http://docs.oracle.com/javase/tutorial/java/data/numberclasses.html.
 
reply
    Bookmark Topic Watch Topic
  • New Topic