Why can't strings be mutable in Java and .NET?

后端 未结 17 2250
不思量自难忘°
不思量自难忘° 2020-11-22 14:04

Why is it that they decided to make String immutable in Java and .NET (and some other languages)? Why didn\'t they make it mutable?

17条回答
  •  盖世英雄少女心
    2020-11-22 14:33

    The decision to have string mutable in C++ causes a lot of problems, see this excellent article by Kelvin Henney about Mad COW Disease.

    COW = Copy On Write.

提交回复
热议问题