Why Strings are Immutable in Java?
Before understanding why strings are immutable in java, we need to think about why do we make something immutable? Immutable means once created we cannot change it. The one reason that we can think of making anything immutable is synchronization when it’s shared. It’s the same reason that strings are immutable. In Java, String objects …