What is wrapper class in java?
Hi Friends,
I am new to the Java programming. I know java is Fully Object Oriented Programming language. And everything inside the java programming is based on the class. But the wrapper class is new for me. I am not able to find out the difference between the simple class and wrapper class. It will be great if you provides something regarding the wrapper class of java. I am waiting for your reply.
Re: What is wrapper class in java?
Hi,
The Wrapper class of java represents the base class for a set of data sources. The java wrapper class doesn't comprises the constructors. All of the primitive wrapper classes in Java are immutable. Wrapper class offers library initialization services as well as the access for to the data source servers that the wrapper supports.Wrapper classes are used to represent primitive values when an Object is required. I hope now you have understood what is wrapper class.
Re: What is wrapper class in java?
Please refer following some method of the java wrapper class:
- getVersion :It is used for retrieving the version of the wrapper.
- getName :It is used for retrieving the name of the wrapper.
- getCorelib : It is used for retrieving the library name of the wrapper.
- getType : It is used for retrieving the wrapper type.
Re: What is wrapper class in java?
Hi friend,
Please study following example of Wrapper class of class, it will definitely helpful for you to understand the concept of Wrapper class:
Code:
import java.util.*;
public class WrapperDemo
{
public static void main(String args[])
{
Vector v1 = new Vector();
v1.add(new Integer(1));
v1.add(new Integer(2));
for(int iu=0; iu < v1.size();iu ++){
Integer iuw =(Integer) v1.get(iu);
System.out.println(iuw.intValue());
}
}
}
Re: What is wrapper class in java?
In java the Wrapper class is nothing but the a wrapper class for to the Java API. The wrapper class in java also has special type known as "dynamic array wrapper class". This type of wrapper class is defined for each and every dynamic array which is declared as a parameter within the java program. There are two types of subclasses for to the Wrapper class i.e UnfencedWrapper class and another is FencedWrapper class.
Re: What is wrapper class in java?
Hello friend,
The Wrapper class divided into two sub category such as Atomic wrapper classes and Primitive wrapper class. The wrapper class of java is a class that encapsulates and wraps the functionality of the other component or class.The methods of the java wrapper classes are all static type so that it can be utilized without creating an instance of the matching java wrapper class. The Wrapper class integrated into the "java.util" package.