The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
March 2001

Advertisement

Advertisement
where you can ask and answer Java programming questions.">
artima.com - a resource for Java and Jini developers
Artima | Search | Java | Design | JVM | Jini | Books | Seminars | Subscribe 


Java Answers Forum
March 2001

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Integer class's object is immutable...

Posted by Kishori Sharan on March 14, 2001 at 9:56 AM

All wrapper classes in Java are immutable i.e. once created cannot be assigned a new value. When you want to set a new value to myInt you need to write
myInt = new Integer ( 20 ) ;
That is, you need to create a new object of Integer class and then assign the reference to myInt.



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us