1.

Where is String Pool stored?(a) Java Stack(b) Java Heap(c) Permanent Generation(d) MetaspaceThe question was asked in an interview.The doubt is from Memory Management topic in section Exploring java.lang & java.io of Java

Answer»

Correct CHOICE is (b) JAVA Heap

Easy EXPLANATION: When a string is created; if the string already exists in the pool, the reference of the EXISTING string will be RETURNED, else a new object is created and its reference is returned.



Discussion

No Comment Found

Related InterviewSolutions