Wednesday, December 22, 2010

Java-Boxing and un-boxing


class Boxing {
public static void main (String[] args) {
Integer integer = 10; /*boxing*/
/*boxing of primitive type 10 [int] into class type integer [class Integer]. From jdk 1.5 onwards.
Assigning an int to Integer was not possible in earlier version of jdk.*/
int j = integer + 10; /*un-boxing*/
System.out.println (integer);
System.out.println (j);
}
}

0 comments:

Post a Comment

Contact Form

Name

Email *

Message *

The Insane Techie - Android App

Launched an android app for the blog on 07th June 2016. Get it from google play store... Tips for using the app Use in landscape mo...