Diagram to show Java String’s Immutability
Here are a set of diagrams to illustrate Java String’s immutability. 1. Declare a string The following code initializes a string s. String s = "abcd";String s = "abcd"; The variable s stores the reference of a string object as shown below. The arrow can be interpreted as “store reference of”. 2. Assign one string … Read more