Immutable means that once the object is created, non of its members will change. String
is immutable since you can not change its content.
For example:
String s1 = " abc ";
String s2 = s1.trim();
In the code above, the string s1 did not change, another object (s2
) was created using s1
.