23 How to create object using Literals (Auto Boxing ) in Java ?

AutoBoxing.java

class AutoBoxing
{
public static void main( String args[] )
{
int i = 100;
Integer j = 100; // Auto Boxing

int k = new Integer(100); // Auto Un-Boxing

System.out.println("\n\n Auto Boxing="+j);
System.out.println("\n\n Auto UnBoxing="+k);
}

}




Output:  

Main Focus = How to represent primitive data type in the form of objects.
Previous
Next Post »