What is a Wrapper class?
Answers were Sorted based on User's Feedback
Answer / debapriya patra
When we need to store primitive datatypes as objects, we use
wrapper classes.MEans in utility classes all the utility
classes stores Objects.So when we need to store a primitive
datatype.We make an object of theat primitive data and store it.
Thats why we use Wrapper classes in Java.
| Is This Answer Correct ? | 172 Yes | 21 No |
Answer / janet
Wrapper classes are classes that allow primitive types to
be accessed as objects.
| Is This Answer Correct ? | 111 Yes | 18 No |
Answer / praveen
Say supposing there is a requirement to store only the
object in an array A.The Primitive types cannot be stored in
the same array as the array can accommodate only Objects
here is where Wrapper Class come into picture.ie, we create
wrapper for the primitive types.One such example is as below
Ex:int i;
Wrapper class for the primitive type(int) is created as below:
INTEGER i = new INTEGER();
| Is This Answer Correct ? | 58 Yes | 14 No |
Answer / ravikiran
wrapper class allows us to make use of primitive datatypes
as objects
| Is This Answer Correct ? | 55 Yes | 16 No |
Answer / nikhil
Wrapper classes are classes that allow primitive types to
be accessed as objects.
| Is This Answer Correct ? | 50 Yes | 13 No |
Answer / kanaparthi srinivas
ExAMPLE:
int i=100 // declaration of primitive type.
/* wrapping the primitive data type to corresponding wrapper
class object */
Integer i1=new Integer(i);
| Is This Answer Correct ? | 31 Yes | 5 No |
Answer / darshan
A primitive wrapper class in the Java programming language
is one of eight classes provided in the java.lang package to
provide object methods for the eight primitive types. All of
the primitive wrapper classes in Java are immutable. J2SE
5.0 introduced autoboxing of primitive types into their
wrapper object, and automatic unboxing of the wrapper
objects into their primitive value—the implicit conversion
between the wrapper objects and primitive values.
Wrapper classes are used to represent primitive values when
an Object is required. The wrapper classes are used
extensively with Collection classes in the java.util package
and with the classes in the java.lang.reflect reflection
package.
The primitive wrapper classes and their corresponding
primitive types are:
Primitive type Wrapper class Constructor Arguments
byte Byte byte or String
short Short short or String
int Integer int or String
long Long long or String
float Float float, double or String
double Double double or String
char Character char
boolean Boolean boolean or String
The Byte, Short, Integer, Long, Float, and Double wrapper
classes are all subclasses of the Number class.
| Is This Answer Correct ? | 27 Yes | 10 No |
Answer / vinay
wrapper classes is nothing but the primitive datatypes make
as a class name is called a wrapper class
| Is This Answer Correct ? | 20 Yes | 13 No |
Answer / srinivas d
we can't store the different types of objects(primitive
datatypes can not be stored) in the same array(same types
of objects can be stored). so, we can crate a primitive
data type for int i;
as INTEGER i = new INTEGEr();
This is the procedure actually going on.
| Is This Answer Correct ? | 15 Yes | 8 No |
Answer / sandeep sagala
A primitive wrapper class in the Java programming language
is one of eight classes provided in the java.lang package to
provide object methods for the eight primitive types. All of
the primitive wrapper classes in Java are immutable. J2SE
5.0 introduced auto boxing of primitive types into their
wrapper object, and automatic unboxing of the wrapper
objects into their primitive value—the implicit conversion
between the wrapper objects and primitive values.
Wrapper classes are used to represent primitive values when
an Object is required. The wrapper classes are used
extensively with Collection classes in the java.util package
and with the classes in the java.lang.reflect reflection
package.
The primitive wrapper classes and their corresponding
primitive types are:
Primitive type Wrapper class Constructor Arguments
byte Byte byte or String
short Short short or String
int Integer int or String
long Long long or String
float Float float, double or String
double Double double or String
char Character char
boolean Boolean boolean or String
The Byte, Short, Integer, Long, Float, and Double wrapper
classes are all subclasses of the Number class.This Number
class is subject to the object class
| Is This Answer Correct ? | 6 Yes | 2 No |
In the HashMap, we know the values but we dont know the key, then how can we get the key from HashMap ?????
What is the difference between hashset and treeset in java?
What is the meaning of course?
What are the 8 data types in java?
What is the difference between comparison done by equals method and == operator?
what methods would you overwrite in java.lang.object class?
What is arrays aslist in java?
What is difference between filereader and bufferedreader?
What are locale settings?
What is methodological framework?
What is the size of integer?
What does string [] args mean?