Aryan PrajapatKnowledge Contributor
Apart from the security aspect, what are the reasons behind making strings immutable in Java?
Apart from the security aspect, what are the reasons behind making strings immutable in Java?
Because of security, synchronization, concurrency, caching, and class loading, the String is immutable in Java. The reason for making string final would be to destroy its immutability and help stop others from trying to extend it. String objects are cached in the String pool, making them immutable.