Code:
Output:
class Wrap
{
public static void main(String args[])
{
Integer i = new Integer(10);
int b = 123456;
// ParseInt : convert string into integr
String s = "1";
int a = Integer.parseInt(s);
System.out.println("\n\n ParseInt: "+ a );
// toString : return new string object containing integer
String s1 = new String();
s1 = i.toString();
System.out.println("\n\n toString: "+ s1 );
// byteValue : return integer value as Byte
Integer c = new Integer(123456);
byte d = c.byteValue();
System.out.println("\n\n Byte Value: "+ d );
// doubleValue : return integer as Double
double e = c.doubleValue();
System.out.println("\n\n Double Value: "+ e );
// floatValue : return integer a Float
float f = c.floatValue();
System.out.println("\n\n Float Value: "+ f );
// intValue : return integer as int
int g = c.intValue();
System.out.println("\n\n Int Value: "+ g );
// shortValue : return integer as Short
short h = c.shortValue();
System.out.println("\n\n Short Value: "+ h );
// longValue : return integer as Long
long j = c.longValue();
System.out.println("\n\n Long Value: "+ j );
// compareTo : return 0 if values are equal
int k = c.compareTo(b);
System.out.println("\n\n CompareTo : "+ k );
// int compare(int a , int b) : compare two numbers.
// return 0 if values are equal
// return negative number if a is less than b
// return postive number if a is greater than b
int num1 =10 , num2 =20 ;
int l = c.compare(num1,num2);
System.out.println("\n\n Compare : "+ l );
System.out.println("\n\n Contain of C: "+ c );
// boolean equals(Object intObj)
// returns true if invoking object is equivalent to intObj
// Otherwise returns false
Object o = new Object();
o = 123456;
Boolean m = c.equals(o);
System.out.println("\n\n Equals : "+ m );
int num = 100;
Integer obj1 = Integer.valueOf(num);
System.out.println("\n\n Integer Object: "+obj1);
Float obj2 = 20.11f;
System.out.println("\n\n Float Object: "+ obj2 );
}
}
{
public static void main(String args[])
{
Integer i = new Integer(10);
int b = 123456;
// ParseInt : convert string into integr
String s = "1";
int a = Integer.parseInt(s);
System.out.println("\n\n ParseInt: "+ a );
// toString : return new string object containing integer
String s1 = new String();
s1 = i.toString();
System.out.println("\n\n toString: "+ s1 );
// byteValue : return integer value as Byte
Integer c = new Integer(123456);
byte d = c.byteValue();
System.out.println("\n\n Byte Value: "+ d );
// doubleValue : return integer as Double
double e = c.doubleValue();
System.out.println("\n\n Double Value: "+ e );
// floatValue : return integer a Float
float f = c.floatValue();
System.out.println("\n\n Float Value: "+ f );
// intValue : return integer as int
int g = c.intValue();
System.out.println("\n\n Int Value: "+ g );
// shortValue : return integer as Short
short h = c.shortValue();
System.out.println("\n\n Short Value: "+ h );
// longValue : return integer as Long
long j = c.longValue();
System.out.println("\n\n Long Value: "+ j );
// compareTo : return 0 if values are equal
int k = c.compareTo(b);
System.out.println("\n\n CompareTo : "+ k );
// int compare(int a , int b) : compare two numbers.
// return 0 if values are equal
// return negative number if a is less than b
// return postive number if a is greater than b
int num1 =10 , num2 =20 ;
int l = c.compare(num1,num2);
System.out.println("\n\n Compare : "+ l );
System.out.println("\n\n Contain of C: "+ c );
// boolean equals(Object intObj)
// returns true if invoking object is equivalent to intObj
// Otherwise returns false
Object o = new Object();
o = 123456;
Boolean m = c.equals(o);
System.out.println("\n\n Equals : "+ m );
int num = 100;
Integer obj1 = Integer.valueOf(num);
System.out.println("\n\n Integer Object: "+obj1);
Float obj2 = 20.11f;
System.out.println("\n\n Float Object: "+ obj2 );
}
}
Output: