Written by the Fiveable Content Team โข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโขWritten by the Fiveable Content Team โข Last updated September 2025
Definition
Immutable refers to an object or data structure that cannot be changed after it is created. Once created, its state remains constant throughout its lifetime.
Related terms
Mutable: This term describes objects or data structures that can be modified after creation. Unlike immutable objects, mutable ones can have their state altered.
In Java programming language, using the "final" keyword makes variables constant and classes uninheritable. It ensures immutability and prevents modification.
String Class: Strings in many programming languages are often immutable objects by default. Any modifications to strings create new string objects rather than modifying existing ones.