Immutable
Definition:
An object whose state cannot be changed after it is created.
Detailed Explanation
- Any modification creates a new object rather than altering the original.
- Immutable objects are thread-safe and predictable.
- Common examples: strings in many languages, numeric wrappers.
Example
// Immutable string example // string s1 = "Hello"; // string s2 = s1; // s2 = "World"; // s1 remains "Hello"