Basic example using Wrapper Class in Java


Here is the simple program for printing basic example using wrapper class in Java.

Source Code

import java.io.*;
import java.util.*;
class wrap
{
  public static void main(String args[])
  {
   byte b1 =68;
   String s1="78";
   Byte b=new Byte(b1);
   Byte c=new Byte(s1);
   System.out.print("\n Byte Object:"+b);
   System.out.print("\n Byte Object:"+c);
   short a=65;
   String d="78";
   Short e=new Short(a);
   Short f=new Short(d);
   System.out.print("\n Short Object:"+e);
   System.out.print("\n Short Object:"+f);
   int a1=100;
   String str=Integer.toString(a1);
   System.out.print("\n String Object:"+str);
   String d1="98";
   int in=Integer.parseInt(d1);
   System.out.print("\n Integer Object :"+(in+10));
  }
}
To download raw file Click Here

Output

 Byte Object:68
 Byte Object:78
 Short Object:65
 Short Object:78
 String Object:100
 Integer Object :108


Learn All in Tamil © Designed & Developed By Tutor Joes