What is a reason for having strings be immutable?

Strings will never get a race condition because of corruption. Immutable classes are easier to design, implement and use than mutable classes. They are less prone to error and are more secure. An immutable object can be in exactly one state, the state in which it was created.

1 comment:

  1. A good article and very interesting. Thank you for helping make this article very interesting.