Is there any difference between Immutable objects and classes? according to my understanding from mock tests Math is an immutable class. objects of Double, Integer etc., are immutable objects.
SCJP 1.4<p>Wingardium Leviosa!!
chintan desai
Greenhorn
Joined: Oct 16, 2002
Posts: 10
posted
0
Originally posted by Don Bosco: Is there any difference between Immutable objects and classes? according to my understanding from mock tests Math is an immutable class. objects of Double, Integer etc., are immutable objects.
According to my understanding Math Class is final class so it can not be subclassed or extended. Objects of Doubl,Integer Etc. (Wrapper Classes) are immutable objects so their objects can not be changed.
Jose Botella
Ranch Hand
Joined: Jul 03, 2001
Posts: 2120
posted
0
Is it possible to change the state of a class? I do not think so. Math is a utility class: uninstantiable and full of static useful methods. A immutable class should produce immutable instances.