Posted On: Apr 08, 2020
The strings are Immutable in Java as the String items are stored in the String pool. Since stored String literals appear to be shared among multiple users there is constantly a danger, where one user's action might affect all different users. For instance, if one user adjusts the estimation of String "Test" to "TEST", all different users will also recognize that as "TEST".
Since storing String items was necessary from administration reason this danger was circumvented by creating String class Changeless. At a similar time, String was declared final so that no one may yield invariant of String type like Immutability, hashcode calculation, Caching, etc by increasing and reversing functions.
Never Miss an Articles from us.