Post 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: 1573 Location: Earth Has thanked: 10 time Have thanks: 16 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 .
Users browsing this forum: No registered users and 2 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum