aspose 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
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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 .
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
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