"And the trouble is, if you don't risk anything, you risk even more." -- Erica Jong.
Shoumin Li
Ranch Hand
Joined: Jul 06, 2007
Posts: 85
posted
0
As I known,these are some rules for making a class immutable: 1. Don't provide any methods that modify the object (known as mutators). 2. Ensure that no methods may be overridden. 3. Make all fields final. 4. Make all fields private. 5. Ensure exclusive access to any mutable components.
[ July 25, 2007: Message edited by: Shoumin Li ] [ July 25, 2007: Message edited by: Shoumin Li ]