Saturday, 7 March 2015

WRAPPER CLASS IN JAVA

Wrapper class is a class which used convert value type.

Convert from string to integer by wrapper class.Here "Integer" as a wrapper class.

Example:


class wrapper
{
    public static void main(String args[])
{
    String x="1";
    String y="2";
    int p=Integer.parseInt(x);
    int q=Integer.parseInt(y);
    int z=p+q;
    System.out.println(z);
}
}


Sample Output :    3 

No comments:

Post a Comment