Wrapper class: Convert integer variable to object type in java.

In my last post I have shared about How to share and call a class from another class.Today I will share with you about type conversion process in java. For example: int to object conversion, float to object conversion etc.

By using the wrapper class primitive data types for example: int, float,long, char can be converted into object types.

 Here is the example

Integer AgeVal= new Integer(i);

Float  FltVal= new Float(f);

Double DblVal= new Double(d);

Long LngVal= new Long(l);

Here i,f,d,l  are primitive data types indicating integer, float, double and long data types.

One Response to Wrapper class: Convert integer variable to object type in java.

  1. priya says:

    Wrapper Classes are Classes that have written to make objects from the primitive types in Java. They are used to wrap the primitive values in an object.Many thanks for sharing this.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: