Code subject: Boxing and unboxing make using wrapper classes
Posted: Sat Aug 29, 2009 2:36 pm
Joined: Tue Mar 27, 2007 10:55 pm Posts: 2103 Location: Earth Has thanked: 39 time Have thanks: 56 time
Code:
public class BoxingTest { public static void main(String args[]) { // non auto boxing Integer x = new Integer(10); int y = x.intValue(); System.out.println("Y = "+y);
// auto boxing Integer z = new Integer(43); z++; System.out.println("z = "+z);
Integer h = new Integer(44); System.out.println("h = "+h);
// Comparing two refferences System.out.println("z == h "+(h == z ));
} }
_________________ Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )