• 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

use of wrapper class

 
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi folks

i want to know the purpose of wrapper class in java

looking for your replies

regards
amir
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
wrapper class are there to bring object behaviour to primitives.
 
Marshal
Posts: 79466
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wrapper classes also provide methods which manipulate or investigate primitives, eg "toBinaryString()", "isJavaIdentifierPart()" and some data eg MAX_VALUE.
Look up the wrapper classes in the API: Boolean, Byte, Character, Double, Float, Long, Integer, Number, Short. I think it unfortunate that two wrapper classes have different names from their primitive counterparts. I have included Number since it is the cuperclass of several of the wrapper classes.
 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when and where the necessities will be arised

to represent a primitive type as an object

apart from putting primitive type objects in a collection

regards
amir
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Wrapper class you will find several utility methods for eg: Integer has method to convert an int to a String and a String to an int etc, Character has methods to change the cases, check for digits, identify spaces etc
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic