Posted On: Mar 17, 2020
The string is Immutable in Java language for certain reasons. One of the reasons for doing so is due to the fact that every string object is cached in the String pool. There is a risk associated because of multi-sharing of string literals among many clients as an action of a particular client affect other clients. To reduce this risk of compromising string class and to optimize performance, a string has to be immuted in java. Because of the importance and popularity of strings just like the HashMap, it is vital for the strings to be immutable as a mutable string can give two distinct hash codes.
Never Miss an Articles from us.
In order to load the Java Classes into a virtual environment, Classloader are used. A class loader will load key classe..