Convert Wrapper Class to Data Types

What is Wrapper Class in Java Program?

Integer, String, Double, Short, Long, Float etc are wrapper class in java programs. These classes have many important methods which are using in programming.

Like convert String class value to int data types. In this step will use parseInt(StringValue) method. And this method is belongs to Integer Class.

Let’s see simple example and videos on our topic.

 

class wrapper1

{

                public static void main(String args[])

                {

                                int x;      // Simple Data Types

                                // Want to add value using command prompt

                                x = Integer.parseInt(args[0]);     // args[0] is wrapper class object

                                // x is simple data types

                                // How to store int value ??

                                // Step 1: Convert into Integer Wrapper Class

                                // Step 2 : Store value in normal data Types

 

                                System.out.println(“X = ” + x);

                }

}

Output:

If user adds 10 in comment prompt then

X = 10

 

Video available on YouTube.


If you have any query on blog example, you can directly comment us or subscribe our website


Earn Money Online

1319total visits,9visits today


mayank

Hello, I am Maddy a Java blogger, trainer and developer

Related articles

5 Comments

  1. November 15, 2016 - 8:31 am

    Attractive component to content. I simply stumbled upon your blog and in accession capital to assert that I acquire in fact loved account your blog posts. Any way I’ll be subscribing for your feeds and even I fulfillment you get entry to persistently rapidly.

  2. November 15, 2016 - 4:38 pm

    Hmm it looks like your blog ate my first comment (it was super long) so I guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your blog. I too am an aspiring blog writer but I’m still new to the whole thing. Do you have any tips and hints for inexperienced blog writers? I’d certainly appreciate it.|

  3. December 10, 2016 - 4:59 pm

    Hi mates, good article and pleasant urging commented here, I am genuinely enjoying by
    these.

  4. December 17, 2016 - 3:13 pm

    I just want to tell you that I’m very new to blogs and certainly savored you’re web site. Most likely I’m want to bookmark your website . You amazingly come with fabulous articles and reviews. Appreciate it for sharing with us your website.

  5. December 28, 2016 - 4:59 pm

    What’s up to all, how is the whole thing, I think
    every one is getting more from this web site, and your views are fastidious designed for new people.

Leave a Reply

Your email address will not be published. Required fields are marked *

Your comments (*)

Name (*)

Your full name please.

Email address (*)

Used for gravatar.

Website

Link back if you want.

Enter Captcha Here :*

Reload Image