aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Constant String Pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Constant String Pool " Watch "Constant String Pool " New topic
Author

Constant String Pool

Pavan Shahi
Ranch Hand

Joined: May 01, 2006
Posts: 39
Hi
When we create a string literal like

String str=�SCJP�;

Then what happen actually is a String Object is created on Constant String Pool or Object is created on heap as any other object and Constant String Pool contain only reference of that object crrated.

Thanks
Pavan


SCJP 1.4 (93%)<br />SCBCD 5 (96%)
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
http://www.javaranch.com/journal/200409/Journal200409.jsp#a1
faisal usmani
Ranch Hand

Joined: Jan 14, 2006
Posts: 139
Hello Pavan ,

Welcome to Javaranch, regarding your question the literal is on heap and reference varibale to the literal is in String Pool .


Hope i answered you

-faisal
[ May 09, 2006: Message edited by: faisal usmani ]
Shaliey Gowtham
Ranch Hand

Joined: Mar 20, 2006
Posts: 104
Objects are always created on the heap.
The reference to the literal Objects are stored in the String pool.
And the reference variable str also contains the same value as the reference value in the String pool.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Constant String Pool