Mutable
Definition:
An object whose state can be changed after creation.
Detailed Explanation
- Mutable objects allow modification of internal data without creating a new object.
- Care must be taken in multi-threaded environments to avoid race conditions.
- Arrays and lists are common mutable structures.
Example
// Mutable array example // int[] nums = 3; // nums[0] = 99; // changes original array