Code:
public class Test
{
public static void main( String args[] )
{
short s1 = 235;
String s2 = "500";
Short s3 = new Short(s1);
Short s4 = new Short(s2);
System.out.println(" s1: "+s1);
System.out.println(" s2: "+s2);
System.out.println(" s3: "+s3);
System.out.println(" s4: "+s4);
int a1 = 200;
String a2 = "300";
Integer a3 = new Integer(a1);
Integer a4 = new Integer(a2);
System.out.println(" a1: "+a1);
System.out.println(" a2: "+a2);
System.out.println(" a3: "+a3);
System.out.println(" a4: "+a4);
float f1 = 123.345F;
double f2 = 456.56D;
String f3 = "23.890";
Float f4 = new Float(f1);
Float f5 = new Float(f2);
Float f6 = new Float(f3);
System.out.println(" f1: "+f1);
System.out.println(" f2: "+f2);
System.out.println(" f3: "+f3);
System.out.println(" f4: "+f4);
System.out.println(" f5: "+f5);
System.out.println(" f6: "+f6);
char c1 = 'a';
Character c2 = new Character(c1);
System.out.println("c1:"+c1);
System.out.println("c2:"+c2);
}
}
Output:
public class Test
{
public static void main( String args[] )
{
short s1 = 235;
String s2 = "500";
Short s3 = new Short(s1);
Short s4 = new Short(s2);
System.out.println(" s1: "+s1);
System.out.println(" s2: "+s2);
System.out.println(" s3: "+s3);
System.out.println(" s4: "+s4);
int a1 = 200;
String a2 = "300";
Integer a3 = new Integer(a1);
Integer a4 = new Integer(a2);
System.out.println(" a1: "+a1);
System.out.println(" a2: "+a2);
System.out.println(" a3: "+a3);
System.out.println(" a4: "+a4);
float f1 = 123.345F;
double f2 = 456.56D;
String f3 = "23.890";
Float f4 = new Float(f1);
Float f5 = new Float(f2);
Float f6 = new Float(f3);
System.out.println(" f1: "+f1);
System.out.println(" f2: "+f2);
System.out.println(" f3: "+f3);
System.out.println(" f4: "+f4);
System.out.println(" f5: "+f5);
System.out.println(" f6: "+f6);
char c1 = 'a';
Character c2 = new Character(c1);
System.out.println("c1:"+c1);
System.out.println("c2:"+c2);
}
}
Output: