I have a big doubt about whether the string constant pool is part of the run-time constants pool created in the method area of the JVM or if they are part of the heap. I have read multiple articles on Google and some say it's part of the heap while some say it's part of the run-time constant pool. Also, does the SCP consist of string literals in terms of objects? and if yes are they allowed to be garbage collected? Please guide me on the same for the clarity
Asked
Active
Viewed 42 times
0

trincot
- 317,000
- 35
- 244
- 286

Nitesh Agrawal
- 9
- 3
-
Does this help? https://www.baeldung.com/java-string-constant-pool-heap-stack – teapot418 Jun 02 '23 at 15:12
-
I think this is incorrect – Nitesh Agrawal Jun 02 '23 at 15:23
-
Please check this - https://stackoverflow.com/questions/4918399/where-does-javas-string-constant-pool-live-the-heap-or-the-stack?rq=2 – Nitesh Agrawal Jun 02 '23 at 15:24
-
1It may help to read [this answer](https://stackoverflow.com/a/47833367/2711488) first, to clarify the terminology. [This Q&A](https://stackoverflow.com/q/70346805/2711488) may also help. – Holger Jun 02 '23 at 18:11
-
hello, @Holger I found your answer fascinating but I could not understand it completely. Can we connect by any means so that you could explain me more in simple terms – Nitesh Agrawal Jun 02 '23 at 18:39