+ 1

What is String Constant Pool in java?

13th Jul 2020, 10:56 AM
Gauri Shirkande
Gauri Shirkande - avatar
5 Respuestas
+ 2
Thanks a lot! Got a clear idea🤘✨
13th Jul 2020, 12:55 PM
Gauri Shirkande
Gauri Shirkande - avatar
+ 1
But what is its use?
13th Jul 2020, 11:10 AM
Gauri Shirkande
Gauri Shirkande - avatar
+ 1
Gauri Shirkande Go through the link given by @Nilesh. It has all explanations.. Bwt in short for you, Java uses a separate memory location for storing string literals. That area of memory location is called String Constant pool.. So use is storing string constants, which you used in your programs.. Java maintains this for better security through string immutability.. means not modifiable. See in pool, same values of different variables, pointing to single location., not a different locations.. Hope it helps...
13th Jul 2020, 12:39 PM
Jayakrishna 🇮🇳
0
Two equal string literals and one memory place - it saves memory. All string in one memory area - it saves speed because with the new string it has to check if it is in the pool.
13th Jul 2020, 12:57 PM
zemiak