• Post Reply Bookmark Topic Watch Topic
  • New Topic

use of wrapper class

 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi folks

i want to know the purpose of wrapper class in java

looking for your replies

regards
amir
 
jayalal jayarathna
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wrapper class are there to bring object behaviour to primitives.
 
Campbell Ritchie
Marshal
Posts: 53146
124
  • Mark post as helpful
  • send pies
  • 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: 241
  • Mark post as helpful
  • send pies
  • 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
 
Srikanth Ramu
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • 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
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!