File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes what is the exact definition of Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "what is the exact definition of "immutable"?" Watch "what is the exact definition of "immutable"?" New topic
Author

what is the exact definition of "immutable"?

Steven Zeng
Ranch Hand

Joined: Jan 15, 2002
Posts: 41
Here is a scjp question :
which of the following classes produce immutable object :
a java.lang.Double
b java.lang.StringBuffer(i know it is false)
c java.lang.Boolean
d java.lang.Math


SCJP2
Mike Shn
Ranch Hand

Joined: May 26, 2001
Posts: 149
Immutable means, once created, the contained value can't be changed.
P.S Do you preparing to take the 310-025 exam?
[ June 12, 2002: Message edited by: Mike Shn ]
Thiru Thangavelu
Ranch Hand

Joined: Aug 29, 2001
Posts: 219
I think the answer is Double and Boolean. Math class doesn't have any public constructors, so an instance can't be created.


Thanks,<br />Thiru<br />[SCJP,SCWCD,SCBCD]
Akhilesh Varma
Greenhorn

Joined: May 02, 2002
Posts: 7
all wrapper classes and the string class objects are immutable so ans is double and boolean


Thanks,<br />Akhi
Steven Zeng
Ranch Hand

Joined: Jan 15, 2002
Posts: 41
Thanks ,all .I agree at your answer .
 
Consider Paul's rocket mass heater.
 
subject: what is the exact definition of "immutable"?
 
Similar Threads
Is the Math class considered immutable?
Wrapper Classes
Immutable classes
Wrapper Classes
string vs stringbuffer