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
posted Jun 12, 2002 10:04:00
0
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 .
subject: what is the exact definition of "immutable"?