Category:
Java
- There are several benefits of String because it’s immutable and final. String Pool is possible because String is immutable in java.
- It increases security because any hacker can’t change its value and it’s used for storing sensitive information such as database username, password etc.
- Since String is immutable, it’s safe to use in multi-threading and we don’t need any synchronization.
- Strings are used in java classloader and immutability provides security that correct class is getting loaded by Classloader.