Java Quiz Flashcards
1
Q
Why Is String Immutable in Java?
A
The key benefits of keeping this class as immutable are caching, security, synchronization, and performance.
2
Q
Java String Pool?
A
Java String Pool is the special memory region where Strings are stored by the JVM
3
Q
Interning
A
Since Strings are immutable in Java, the JVM optimizes the amount of memory allocated for them by storing only one copy of each literal String in the pool. This process is called interning