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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Java String Pool?

A

Java String Pool is the special memory region where Strings are stored by the JVM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly