How does Java string being immutable increase security?
问题 I am new to Java and when learning, I came across the fact that a String is immutable. When I was reading the reason behind it, a few reasons came up, for example performance increasements, since its value cannot be modified, and it can be shared by multiple threads. These reasons I do understand. But I don't get how it is related to security. How does a String being immutable help in Java security? Please help me in understanding. Thanks in advance. 回答1: A very common practice in writing