File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes @Wrapper class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "@Wrapper class" Watch "@Wrapper class" New topic

@Wrapper class

rahul kadam

Joined: May 03, 2001
Posts: 2
what is @ wrapper class?
where it is used?
Ajith Kallambella

Joined: Mar 17, 2000
Posts: 5782
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.

Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
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.


So much trouble in the world -- Bob Marley
Susan Delph
Ranch Hand

Joined: Feb 24, 2001
Posts: 34
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.

[This message has been edited by Susan Delph (edited May 06, 2001).]
I agree. Here's the link:
subject: @Wrapper class
It's not a secret anymore!