• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

@Wrapper class

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is @ wrapper class?
where it is used?
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops! This is not the best place to ask this question. Why not I move this discussion to Java in General(beginner) forum..
Feel free to continue the topic there.
 
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wrapper classes are used to wrap primitive values so that they can be used as objects, if there is a need to. Such as inserting in Collections, etc.

Bosun
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bosun gave a nice definition. Here's an example:
You've probably seen:
int x;
This creates the integer variable 'x'.
But you could also use an Integer wrapper, so that 'x' is treated as an object:
Integer x = new Integer();
From the Sun documentation:
"The Integer class wraps a value of the primitive type int in an object. An object of type Integer contains a single field whose type is int. "
There's a wrapper class for each primitive type.

Susan
[This message has been edited by Susan Delph (edited May 06, 2001).]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!