1

As of Java 7, read that String intern pool has been moved from PermGen to the main memory!

What is the exact area where this pool is stored? Is it method area or is it in heap only?

How many string intern pools are there for an execution? Is it per-class?

  • see [enter link description here](https://stackoverflow.com/questions/1855170/when-should-we-use-intern-method-of-string-on-string-literals) – hoohack Dec 14 '18 at 10:31

1 Answers1

1

Google is your friend.

Summary: Pool has been changed, where it lies now doesn't matter, it still a tool you should not use except for a few special edge cases.

TwoThe
  • 13,879
  • 6
  • 30
  • 54
  • Thanks and it says it does lie in the heap and I assume it is just one single string intern pool that gets created right? – UserInteractive Nov 16 '13 at 17:34
  • It also says that it holds one single instance of String object for string literals. Is it true for string literals that are equal(one reference for all the strings that are equal) or is it just one reference for ALL string literals. Could you point me to the part in the link if that has the answer? – UserInteractive Nov 16 '13 at 17:37
  • Everything is in heap (really everything!) and there is only one pool, because two wouldn't make sense. In this pool are all Strings that are either hard-coded into the code or that have been put there through String.intern(). As it is a _pool_ there are many Strings in that pool. – TwoThe Nov 17 '13 at 10:31