What is a Wrapper class?

Answers were Sorted based on User's Feedback



What is a Wrapper class?..

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

What is a Wrapper class?..

Answer / janet

Wrapper classes are classes that allow primitive types to
be accessed as objects.

Is This Answer Correct ?    111 Yes 18 No

What is a Wrapper class?..

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

What is a Wrapper class?..

Answer / ravikiran

wrapper class allows us to make use of primitive datatypes
as objects

Is This Answer Correct ?    55 Yes 16 No

What is a Wrapper class?..

Answer / nikhil

Wrapper classes are classes that allow primitive types to
be accessed as objects.

Is This Answer Correct ?    50 Yes 13 No

What is a Wrapper class?..

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

What is a Wrapper class?..

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

What is a Wrapper class?..

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

What is a Wrapper class?..

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

What is a Wrapper class?..

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

Post New Answer

More Core Java Interview Questions

What is java util hashmap?

0 Answers  


Explain thread in java?

0 Answers  


What is difference overloading and overriding?

0 Answers   Cyient,


What is the java virtual machine?

0 Answers  


What is meant by inheritance and what are its advantages?

0 Answers  






Can we create an object of private class?

0 Answers  


Do we have pointers in java?

0 Answers  


What is the purpose of nested class in java?

0 Answers  


why there are multiple catches for a try block.don't tell me that there can be multiple exception of a code segment that's why.tell me the real fact behind this.

4 Answers  


What is final, finally, finalize?

0 Answers  


what do you mean by classloader in java?

0 Answers  


How many bytes are there?

0 Answers  


Categories