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 |
What is <> used for in java?
Which is the class in java?
Outline the major features of java.
What is difference between printf and scanf?
how to write a server program and sending the mails to the server using smtp protocol please help me
When abstract methods are used?
why we r not use pointers in corejava?
What is appletviewer?
What is pre increment and post increment in java?
What is unicode in java?
What is null object in java?
What is the equal sign?